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

Re: xsl:variable and position question and experience

Subject: Re: xsl:variable and position question and experience
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Mon, 3 Mar 2003 07:02:11 +0100
question on experience
>      Example:
>      1) Inside a template match on *, or $file1//Product the following
strangeness occurs:
>
>      <xsl:value-of select="$file1//Product[1]/@name" /> prints the name of
the product
>      but <xsl:value-of select="$file1//Product[2]/@name"/> does not print
anything.



I tried to reproduce your observations and failed completely. The following
transformation:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method="text"/>

  <xsl:template match="/">

    <xsl:variable name="v"
         select="document(/files/file[1]/@href, /)"/>

    <xsl:value-of select="$v//Product[1]/@name"/>
    <xsl:text>&#xA;</xsl:text>
    <xsl:value-of select="$v//Product[2]/@name"/>

  </xsl:template>
</xsl:stylesheet>

when performed against this source.xml:

<files>
  <file href="testxp42.xml" />
  <file href="file2.xml" />
</files>

where testxp42.xml is:

<file>
  <Products>
    <Product name="1"/>
    <Product name="2"/>
    <Product name="3"/>
  </Products>
</file>


produces the following result:

1
2


This result is produced by: MSXML3/4, Saxon 6.5.2, XalanJ 2.4.1, XalanC 1.3
and MS .Net xsltTtransform.



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

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
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.