 |
 |
 |
Hi Cenk,
> Here is the part of XSL:
>
> <xsl:for-each select="b[@at=$something]">
> <xsl:value-of select="../b"/>
> </xsl:for-each>
When you use xsl:for-each, the processor cycles through the nodes that
you select (in this case the b elements whose 'at' attribute equals
the value of the variable $something). Within the xsl:for-each, the
particular node that's being processed becomes the current node, and
all the paths within the loop are resolved relative to this current
node.
Now, in your case, on each iteration, a b element is the current node.
You use the path "../b" within the xsl:value-of element. This tells
the processor to go up to the parent of the current b element (to the
a element) and then down again to get all the b element children of
that element. This always gives you a node set containing all the b
elements. xsl:value-of gives you the value of whatever you select; if
you select a node set, like you're doing here, it gives you the value
of the first node in that node set. So each time you get the value of
the first b element within the a element.
I think that what you want to do is get the value of the current b
element, the one you're looking at within the loop. To do that, just
use the XPath ".":
<xsl:for-each select="b[@at = $something]">
<xsl:value-of select="." />
</xsl:for-each>
(BTW, if you want to copy it rather than get its value, just use
xsl:copy-of instead of xsl:value-of.)
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
 | 



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