XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
RE: [xml-dev] 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@iro.umontreal.ca] 
> Sent: 12 January 2007 17:20
> To: xml-dev@lists.xml.org
> Subject: [xml-dev] 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@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org 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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS