[xsl] Selecting and printing certain nodes

Subject: [xsl] Selecting and printing certain nodes
From: "Glenn MacGregor" <gtm@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 19 Feb 2004 16:02:20 -0500
Hi All,

I am having a problem printing certain nodes to the result tree. Here is
the XML I am working on:

...
<tr><td><b>Before</b> After Variable</td/</tr>
...

I have it to the point where I am printing the <tr>,<td> and <b> tags. The
problem is the result is:
<tr><td><b></b></td></tr>  Where did all my text go?

XSL:
<xsl:template name="foreachOutput">
    <xsl:param name="cdata"/>
    <xsl:param name="do-sect"/>
    <xsl:for-each select="$do-sect">
        <xsl:choose>
            <xsl:when test="name() = 'variable'">
                <xsl:call-template name="insertVariable">
                    <xls:with-param name="var" select="$data"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:element name="{name()}">
                    <xsl-copy-of select="@*"/>
                    <xsl:call-template name="foreachOutput">
                        <xsl:with-param name="do-sect" select="./*"/>
                        <xsl:with-param name="cdata" select="$cdata"/>
                    </xsl:call-template>
                </xsl:element>
            </xsl:otherwise>
        </xsl:choose>
    <xsl:for-each>
</xsl:template>

>From the above snipit of XML (<tr><td>...) I assume I am not getting into
the <xsl:when test="name()='variable'"> section so I am in the
<xsl:otherwise> which uses the <xsl:element> I assume that is where my
problem lies but I can't figure out how to get around it to print all the
text as well as the elements.

    Thanks

            Glenn


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread