469,142 Members | 1,125 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,142 developers. It's quick & easy.

test of following-sibling[2] does not work

Hi,

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?

cheers,

//mikael
xml
===

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

xsl
===
<xsl:for-each select="structMember">
<xsl:choose>
<xsl:when test="following-sibling[2][name(.) = 'enumRef']">
<xsl:call-template name="enumNameString">
<xsl:with-param name="enumRefName" select="@name"/>
</xsl:call-template>"</xsl:when>
<xsl:otherwise>
<xsl:text>"</xsl:text><xsl:value-of select="@name"/>"
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(position()=last())">,</xsl:if>
</xsl:for-each>
Feb 6 '06 #1
1 1202
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"
select="child::*[2][self::enumRef]/@name"/>
</xsl:call-template>"</xsl:when>

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

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 CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.