471,607 Members | 2,211 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,607 software developers and data experts.

test of following-sibling[2] does not work


If sibling # 2 is enumRef, in xsl, I will call enumNameString template.
In my example, xml, it is an enumRef but still the call to enumNameString
is not performed. The otherwise is performed :-)

Any ideas why?



<structMember name="aichTiming">
<description>Timing sensor
<enumRef name="Aich_Timing">

<xsl:for-each select="structMember">
<xsl:when test="following-sibling[2][name(.) = 'enumRef']">
<xsl:call-template name="enumNameString">
<xsl:with-param name="enumRefName" select="@name"/>
<xsl:text>"</xsl:text><xsl:value-of select="@name"/>"
<xsl:if test="not(position()=last())">,</xsl:if>
Feb 6 '06 #1
1 1262
Hi Mikael,

What you want is not the a sibling of structMember, you want to check
the second child of structMember and for that you should use the child
axes like below. Also the test does not change the context node so
@name will select the structMember name and if you want the
enumRef/@name then you should first get to that node:

<xsl:when test="child::*[2][self::enumRef]">
<xsl:call-template name="enumNameString">
<xsl:with-param name="enumRefName"

Best Regards,
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger

Feb 6 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Remy Blank | last post: by
10 posts views Thread by Randell D. | last post: by
5 posts views Thread by Sakcee | last post: by
6 posts views Thread by ypjofficial | last post: by
176 posts views Thread by nw | last post: by
reply views Thread by =?Utf-8?B?bmVlcmFqYkBub2lkYS5ub3NwYW1oY2x0ZWNoLmNv | last post: by
2 posts views Thread by =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.