[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Proposed XPath information instance
Hi folks, I've been working on exposing cardinality in elements and attributes, and I decided it would not be proper to add information to the former ".xml" versions of the "complete" instances. Then, there would be XPath attributes in the instance that are not part of the actual document type. So, I've added all of the cardinality information from the model to an instance I'm calling the "XPath instance". Below you will see the first 50 lines of the Order XPath instance and a sample stylesheet for Micah to extract the same kind of XPath report that he requested. Now the question for the committee: should I reflect cardinality in the text and HTML presentations? For example, here are the first 10 lines of Order.txt: Z:\data\KenData\dev\xsd\UBL-1.0-SBS-0.5\xpaths>head Order.txt 2 /po:Order/po:BuyersID 2.1 /po:Order/po:BuyersID/@identificationSchemeAgencyID 2.2 /po:Order/po:BuyersID/@identificationSchemeAgencyName 2.3 /po:Order/po:BuyersID/@identificationSchemeDataURI 2.4 /po:Order/po:BuyersID/@identificationSchemeID 2.5 /po:Order/po:BuyersID/@identificationSchemeName 2.6 /po:Order/po:BuyersID/@identificationSchemeURI 2.7 /po:Order/po:BuyersID/@identificationSchemeVersionID 3 /po:Order/po:SellersID 3.1 /po:Order/po:SellersID/@identificationSchemeAgencyID To introduce cardinality I could add a column of Kleene operators between the reference key number and the XPath address: 2 /po:Order/po:BuyersID 2.1 ? /po:Order/po:BuyersID/@identificationSchemeAgencyID 2.2 ? /po:Order/po:BuyersID/@identificationSchemeAgencyName 2.3 ? /po:Order/po:BuyersID/@identificationSchemeDataURI 2.4 ? /po:Order/po:BuyersID/@identificationSchemeID 2.5 ? /po:Order/po:BuyersID/@identificationSchemeName 2.6 ? /po:Order/po:BuyersID/@identificationSchemeURI 2.7 ? /po:Order/po:BuyersID/@identificationSchemeVersionID 3 ? /po:Order/po:SellersID 3.1 ? /po:Order/po:SellersID/@identificationSchemeAgencyID The above doesn't look like much since the attributes are all optional and the SellersID element is optional as well. Note how the document element is not optional, so no Kleene operator shows, just a space. For required attributes I would also leave it blank. For "one or more" elements I would use "+" and for zero or more elements I would use "*". If the maxOccurs is a hard number rather than "unbounded" I would use "#" which is not a Kleene operator, but gives the indication that the reader should check out the actual XPath instance where the real number is found. ACTION: please offer your opinion if I should leave text and HTML files the way they are already, without cardinality, and just leave cardinality in these new XPath files ... or should I add the visual indication of cardinality into the text and HTML files? When I start hearing some opinions, I'll finish the files up and package them and post them. I'd like to do this sooner rather than later so we can talk about the end result in Tuesday's meeting. Thanks! .......................... Ken Z:\data\KenData\dev\xsd\UBL-1.0-SBS-0.5\xpaths>head -50 Order-xpath.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- Vocabulary: all names are one character in an effort to keep file size small Attributes: p = prefix Elements: e = element i = URI string a = attribute n = name t = text t = type m = minOccurs x = maxOccurs u = use (values: "o"="optional";"r"="required") --> <e n="Order" t="OrderType" p="po" i="urn:oasis:names:specification:ubl:schema:xsd:Order-1.0" m="1" x="1"> <e n="BuyersID" t="udt:IdentifierType" p="po" m="0" x="1"> <a n="identificationSchemeAgencyID" u="o"/> <a n="identificationSchemeAgencyName" u="o"/> <a n="identificationSchemeDataURI" u="o"/> <a n="identificationSchemeID" u="o"/> <a n="identificationSchemeName" u="o"/> <a n="identificationSchemeURI" u="o"/> <a n="identificationSchemeVersionID" u="o"/> <t/> </e> <e n="SellersID" t="udt:IdentifierType" p="po" m="0" x="1"> <a n="identificationSchemeAgencyID" u="o"/> <a n="identificationSchemeAgencyName" u="o"/> <a n="identificationSchemeDataURI" u="o"/> <a n="identificationSchemeID" u="o"/> <a n="identificationSchemeName" u="o"/> <a n="identificationSchemeURI" u="o"/> <a n="identificationSchemeVersionID" u="o"/> <t/> </e> <e n="CopyIndicator" t="CopyIndicatorType" p="cbc" i="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-1.0" m="0" x="1"> <t/> </e> <e n="GUID" t="udt:IdentifierType" p="po" m="0" x="1"> <a n="identificationSchemeAgencyID" u="o"/> <a n="identificationSchemeAgencyName" u="o"/> <a n="identificationSchemeDataURI" u="o"/> <a n="identificationSchemeID" u="o"/> <a n="identificationSchemeName" u="o"/> <a n="identificationSchemeURI" u="o"/> <a n="identificationSchemeVersionID" u="o"/> <t/> </e> <e n="IssueDate" t="IssueDateType" p="cbc" i="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-1.0" m="1" x="1"> <t/> </e> Z:\data\KenData\dev\xsd\UBL-1.0-SBS-0.5\xpaths>type ..\..\micah.xsl <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output indent="yes"/> <xsl:template match="/"> <sbs for="{e/@p}:{e/@n}"> <xsl:apply-templates select="*"/> </sbs> </xsl:template> <xsl:template match="e|a"> <xpath> <xsl:copy-of select="@m|@x|@u"/> <xsl:for-each select="ancestor-or-self::e"> <xsl:text/>/<xsl:value-of select="concat(@p,':',@n)"/> </xsl:for-each> <xsl:if test="self::a"> <xsl:text/>/@<xsl:value-of select="@n"/> </xsl:if> </xpath> <xsl:apply-templates select="e|a"/> </xsl:template> </xsl:stylesheet> Z:\data\KenData\dev\xsd\UBL-1.0-SBS-0.5\xpaths>saxon Order-xpath.xml ..\..\micah .xsl | head -30 <?xml version="1.0" encoding="utf-8"?> <sbs for="po:Order"> <xpath m="1" x="1">/po:Order</xpath> <xpath m="0" x="1">/po:Order/po:BuyersID</xpath> <xpath u="o">/po:Order/po:BuyersID/@identificationSchemeAgencyID</xpath> <xpath u="o">/po:Order/po:BuyersID/@identificationSchemeAgencyName</xpath> <xpath u="o">/po:Order/po:BuyersID/@identificationSchemeDataURI</xpath> <xpath u="o">/po:Order/po:BuyersID/@identificationSchemeID</xpath> <xpath u="o">/po:Order/po:BuyersID/@identificationSchemeName</xpath> <xpath u="o">/po:Order/po:BuyersID/@identificationSchemeURI</xpath> <xpath u="o">/po:Order/po:BuyersID/@identificationSchemeVersionID</xpath> <xpath m="0" x="1">/po:Order/po:SellersID</xpath> <xpath u="o">/po:Order/po:SellersID/@identificationSchemeAgencyID</xpath> <xpath u="o">/po:Order/po:SellersID/@identificationSchemeAgencyName</xpath> <xpath u="o">/po:Order/po:SellersID/@identificationSchemeDataURI</xpath> <xpath u="o">/po:Order/po:SellersID/@identificationSchemeID</xpath> <xpath u="o">/po:Order/po:SellersID/@identificationSchemeName</xpath> <xpath u="o">/po:Order/po:SellersID/@identificationSchemeURI</xpath> <xpath u="o">/po:Order/po:SellersID/@identificationSchemeVersionID</xpath> <xpath m="0" x="1">/po:Order/cbc:CopyIndicator</xpath> <xpath m="0" x="1">/po:Order/po:GUID</xpath> <xpath u="o">/po:Order/po:GUID/@identificationSchemeAgencyID</xpath> <xpath u="o">/po:Order/po:GUID/@identificationSchemeAgencyName</xpath> <xpath u="o">/po:Order/po:GUID/@identificationSchemeDataURI</xpath> <xpath u="o">/po:Order/po:GUID/@identificationSchemeID</xpath> <xpath u="o">/po:Order/po:GUID/@identificationSchemeName</xpath> <xpath u="o">/po:Order/po:GUID/@identificationSchemeURI</xpath> <xpath u="o">/po:Order/po:GUID/@identificationSchemeVersionID</xpath> <xpath m="1" x="1">/po:Order/cbc:IssueDate</xpath> <xpath m="0" x="1">/po:Order/cbc:Note</xpath> Z:\data\KenData\dev\xsd\UBL-1.0-SBS-0.5\xpaths> -- World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/o/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/o/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]