[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XPath on sequences of nodes
The "/" operator in XPath 2.0 causes the results of the path expression to be delivered in document order. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Fabrizio Gotti [mailto:gottif@i...] > Sent: 12 January 2007 17:20 > To: xml-dev@l... > Subject: XPath on sequences of nodes > > Hi! > > I am observing a strange phenomenon in an xslt-based project, > using the Saxon 8 processor. It pertains to a sequence of > nodes created within a perform-sort instruction. In the > simple xslt sheet following this message, I create a sequence > of nodes, store it in a variable, and I print its content > through 2 very similar instructions, but I get one node > sequence for the first instruction, and another > (inverted) one for the second instruction. > > For the life of me, I don't know what's happening. How can a > variable store 2 different results? I'd really appreciate it > if someone could give me a hint. > > Thank you very much. > > Fabrizio Gotti > RALI - http://rali.iro.umontreal.ca/ > > ============================ > > <?xml version="1.0" encoding="UTF-8"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="2.0" > xmlns:xs="http://www.w3.org/2001/XMLSchema"> > <xsl:output method="xml" indent="yes" encoding="UTF-8" /> > > <xsl:template match="/"> > > <xsl:variable name="selectedSents" as="node()*"> > <xsl:perform-sort> > <xsl:sort order="descending"/> > <sent> > <c>one</c> > </sent> > <sent> > <c>two</c> > </sent> > </xsl:perform-sort> > </xsl:variable> > > <debug> > <!-- Here, the very same variable selectedSents > will yield 2 different representations --> > <bad> > <xsl:copy-of select="$selectedSents/c"/> > <!-- one sequence --> > </bad> > <good> > <xsl:copy-of select="$selectedSents" /><!-- > another sequence, inverted --> > </good> > </debug> > > </xsl:template> > > </xsl:stylesheet> > > > ______________________________________________________________ > _________ > > XML-DEV is a publicly archived, unmoderated list hosted by > OASIS to support XML implementation and development. To > minimize spam in the archives, you must subscribe before posting. > > [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/ > Or unsubscribe: xml-dev-unsubscribe@l... > subscribe: xml-dev-subscribe@l... List archive: > http://lists.xml.org/archives/xml-dev/ > List Guidelines: http://www.oasis-open.org/maillists/guidelines.php >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|