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

RE: xpath query

Subject: RE: xpath query
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 19 Jan 2008 00:46:08 -0000
RE:  xpath query
In XSLT 2.0, when you do <xsl:value-of select="EXPR"/> and EXPR selects a
sequence of nodes, the output consists of the string-values of those nodes,
separated by a single space.

If you want to copy the nodes to the output rather than extracting their
string values, try <xsl:copy-of>.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Sean Tiley [mailto:sean.tiley@xxxxxxxxx] 
> Sent: 18 January 2008 23:46
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  xpath query
> 
> Hi there,
> I am still struggling with mostof this stuff, but I have a 
> question related to the original data.
> 
> <ROOT>
>     <LEVEL2>
>         <B>
>             <a>100</a>
>             <b apply="1">100</b>
>             <c>100</c>
>         </B>
>         <C>
>             <a>100</a>
>             <b>100</b>
>             <c apply="1">100</c>
>         </C>
>         </LEVEL2>
> </ROOT>
> 
> If I create the following stylesheet I get 100 100 output
> 
> <xsl:stylesheet 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
>     <xsl:template match="ROOT">
>         <html>
>             <xsl:value-of select="LEVEL2/*/*[@apply='1']"/>
>         </html>
>     </xsl:template>
> </xsl:stylesheet>
> 
> What I am not clear on is why does this return values and not nodes?
> Or is this really returning both nodes and I am getting the 
> value of each one because of the <xsl:value-of select="..."/> 
> expression?
> 
> As far as I can figure the expression ROOT/LEVEL2/*/*[@apply='1']"
> says give me the  nodes that have the arrtibute apply=1 and 
> are grandchildren of level2.
> 
> I kind of though to get both values I would have to do something like
> 
> <xsl:template match="ROOT">
>       <xsl:for-each select="LEVEL2/*/*[@apply='1']">
>            <xsl:value-of select="."/>
>       </xsl:for-each>
> </xsl:template>
> 
> Sorry if this seems really trivial but it helps me to better 
> understand.
> 
> --
> Thanks
> Sean

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.