Project

Profile

Help

XPath2.0 support for xsd:list

Added by Anonymous over 18 years ago

Legacy ID: #3660955 Legacy Poster: Igor (igorotov)

Does XPath2.0 supports xsd:lists out or the box? How can I select the second list item of an attribute? thanks


Replies (3)

Please register to reply

RE: XPath2.0 support for xsd:list - Added by Anonymous over 18 years ago

Legacy ID: #3661407 Legacy Poster: Michael Kay (mhkay)

In a schema-aware XPath, if attribute colours is defined as; <xs:attribute name="colours"> <xs:simple-type> <xs:list itemType="colour"/> </xs:simple-type> </xs:attribute> <xs:simple-type name="colour"> ... enumeration of "red", "green", "blue" </xs:simple-type> and if your instance is <light colours="blue green"/> then @colours[2] = 'green' will be true. Specifically, any operation that atomizes a value belonging to a list type will generate a sequence of atomic values, one for each item in the list. By the way: questions about the XSLT and XPath languages, as distinct from the Saxon implementation, would be better directed to the xsl-list at mulberrytech.com Michael Kay

RE: XPath2.0 support for xsd:list - Added by Anonymous over 18 years ago

Legacy ID: #3661906 Legacy Poster: Igor (igorotov)

Sorry about posting it here in this forum. Just to follow up your response: What about simple content Element of type list? More specifically what if the element itself has maxOccurs='unbounded"? <lights> <colours>blue green</colours> <colours>blue green</colours> </lights> Would the xpath look like this: /lights/colours[2][2]? thanks again!

RE: XPath2.0 support for xsd:list - Added by Anonymous over 18 years ago

Legacy ID: #3662879 Legacy Poster: Michael Kay (mhkay)

I'm afraid I misinformed you. /lights/@colours[2] selects the second attribute node in the node sequece; if you then atomize it, which you can do explicitly as data(/lights/@colours[2]) (but which normally happens automatically) then you can select the second item in the atomized sequence as data(/lights/@colours[2])[2] Michael Kay

    (1-3/3)

    Please register to reply