All pastes #147696 Raw Edit

Miscellany

public text v1 · immutable
#147696 ·published 2006-08-24 15:55 UTC
rendered paste body
For some reason, the first xsl:for-each is working fine, but the second one (which seems identical to me) returns nothing:

    <xsl:template match="methods">
        <li><xsl:value-of select="@name"/> (<xsl:for-each select="params">
                <xsl:value-of select="@name"/>
                <xsl:if test="position() != last()">, </xsl:if>
        </xsl:for-each>)
            <ul>
            <li class="text">
                <h1>
                    <xsl:value-of select="@name"/> (<xsl:for-each select="params">
                        <xsl:value-of select="@name"/>
                        <xsl:if test="position() != last()">, </xsl:if>
                    </xsl:for-each>)
                </h1>
                <p>
                    <xsl:value-of select="@short"/>
                </p>
                <p>Parameters</p>
                <ul>
                    <xsl:for-each select="params">
                        <li>
                            <xsl:value-of select="@name"/> (<xsl:value-of select="@type"/>): <xsl:value-of select="desc"/>
                        </li>
                    </xsl:for-each>
                </ul>
            </li>
        </ul></li>            
    </xsl:template>

Sample XML:

<methods short='Adds each of the Elements in the array to the set of matched elements.' type='jQuery' name='add' cat='jQuery'>
  <params type='Array&lt;Element&gt;' name='els'>
    <desc>An array of Elements to add</desc>
  </params>
  <desc>Adds each of the Elements in the array to the set of matched elements.
    This is used to add a set of Elements to a jQuery object.</desc>
  <examples>
    <code>$("p").add([document.getElementById("a"), document.getElementById("b")])</code>
    <result>[ &lt;p&gt;Hello&lt;/p&gt;, &lt;span id="a"&gt;Hello Again&lt;/span&gt;, &lt;span id="b"&gt;And Again&lt;/span&gt; ]</result>
    <before>&lt;p&gt;Hello&lt;/p&gt;&lt;p&gt;&lt;span id="a"&gt;Hello Again&lt;/span&gt;&lt;span id="b"&gt;And Again&lt;/span&gt;&lt;/p&gt;</before>
  </examples>
</methods>