0

I have xml like this

<mainProcedure>
    <proceduralStep>
      <proceduralStep>
        <proceduralStep>
          <proceduralStep>
          </proceduralStep>
        </proceduralStep>
      </proceduralStep>
      <proceduralStep>
        <proceduralStep>
        </proceduralStep>
      </proceduralStep>
    </proceduralStep>
 </mainProcedure>

the child node name for mainProcedure node is all same and no attributes and text.

i need to find out which proceduralStep node is clicked and its position.

2
Contributors
1
Reply
12
Views
2 Years
Discussion Span
Last Post by xml_looser
0

use [] bracket as if

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output indent="yes"/>
    <xsl:template match="/">
        <root>
            <xsl:apply-templates select="a"/>
        </root>
    </xsl:template>
    <xsl:template match="a">
        <xsl:apply-templates select="b"/>
    </xsl:template>
    <xsl:template match="b">
        <xsl:apply-templates select="c"/>
    </xsl:template>
    <xsl:template match="c">
        <xsl:apply-templates select="d1[@att2][ position()=1]" mode="a">
            <xsl:with-param name="kn" select="d1[@att2]"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="d1[not(@att2)]"/>
    </xsl:template>
    <xsl:template match="d1">
        <a>
            <b>
                <c>
                    <d1>
                        <xsl:value-of select="."/>
                    </d1>
                </c>
            </b>
        </a>
    </xsl:template>
    <xsl:template match="d1" mode="a">
        <xsl:param name="kn"/>
        <a>
            <b>
                <c>
                    <xsl:for-each select="$kn">
                        <d1>
                            <xsl:value-of select="."/>
                        </d1>
                    </xsl:for-each>
                </c>
            </b>
        </a>
    </xsl:template>
</xsl:stylesheet>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.