Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Simple select question (newbie to xsl+xml) - Selecting from just one node at a time

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 2/6/2008 5:14:00 PM

conorgaff@g... wrote:

> I have several nodes that are identical. They each have a properties
> X:
> 
> <nodes>
>   <node>
>     <X>one</X>
>     <X>two</X>
>   </node>
>   <node>
>     <X>aaa</X>
>     <X>bbb</X>
>   <node>
> </nodes>
> 
> 
> In my xsl I have
> 
> 
>    <xsl:for-each select="//blah/nodes">
> <nodes>
> 
> </node>
> </xsl:for-each>
> 
> 
> Which is fine for getting each of the nodes out, but problem arises
> when I try to take out X properties of the individual node in
> transform.
> 
> I keep getting all values of all X properties in each node by using
> <xsl:for-each select="//X">:

I guess you are looking for relative XPath expressions e.g.
   <xsl:for-each select="/nodes/node">
     <xsl:for-each select="X">
That way the inner for-each selects only the 'X' elements of the 'node' 
element selected by the outer for-each.

So be careful with prefixing XPath expressions with //, that way you are 
always looking at descendants of the root node.

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent