[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XPath on sequences of nodes

  • From: "Michael Kay" <mike@s...>
  • To: "'Fabrizio Gotti'" <gottif@i...>,<xml-dev@l...>
  • Date: Fri, 12 Jan 2007 17:38:42 -0000

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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.