|
Subject: Re: [xsl] Noob: hmm using nested templates, how do i get the nodes within From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Thu, 18 Sep 2003 13:07:38 -0400 |
so now i heard i could use nested template, like ------------------------------------------------- <xsl:template match="//Row"> <fo:table-row> <fo:table-cell border="solid black 1 px" border-collapse="collapse"> <fo:block> <xsl:value-of select="TT"/> </fo:block> </fo:table-cell> <xsl:call-template name="cell"/> </fo:table-row> </xsl:template>
<Row> <aaa>Total</aaa> <TdD>null</TdD> <NA>45678</NA> <FR>45644</FR> </Row>
<xsl:template name="cell">
<fo:table-cell border="solid black 1 px" border-collapse="collapse">
<fo:block>
<xsl:variable name="cell" select="//Row/[*]"/> <---------------Here's where i think i go wrong, how do i select the nodes
<xsl:template match="TdD | NA | FR">
<fo:table-cell border="solid black 1 px" border-collapse="collapse">
<fo:block>
<!-- we don't need to bind any nodes to the variable: rather, the
node we're interested in is whatever node we matched:
our context node -->
<xsl:choose>
<xsl:when test="not(self::node() = 'null')">
<xsl:value-of select="self::node()"/>
</xsl:when>
</xsl:choose>
</fo:block>
</fo:table-cell>
</xsl:template><xsl:template match="TdD | NA | FR">
<fo:table-cell border="solid black 1 px" border-collapse="collapse">
<fo:block>
<xsl:value-of select="self::node()[not(.='null')]"/>
</fo:block>
</fo:table-cell>
</xsl:template><xsl:template match="Row">
<fo:table-row>
<fo:table-cell border="solid black 1 px" border-collapse="collapse">
<fo:block>
<xsl:value-of select="child::TT"/>
<!-- whatever that is... I think you mean select="aaa" -->
</fo:block>
</fo:table-cell>
<xsl:apply-templates name="child::TdD | child::NA | child::FR"/>
</fo:table-row>
</xsl:template><xsl:template match="Row">
<fo:table-row>
<fo:table-cell border="solid black 1 px" border-collapse="collapse">
<fo:block>
<xsl:value-of select="child::TT"/>
<!-- whatever that is... I think you mean select="aaa" -->
</fo:block>
</fo:table-cell>
<xsl:call-template name="cell">
<xsl:with-param name="contents" select="TdD | NA"/>
</xsl:call-template>
<xsl:call-template name="cell">
<xsl:with-param name="contents" select="FR"/>
</xsl:call-template>
</fo:table-row>
</xsl:template><xsl:template name="cell">
<xsl:param name="contents" select="."/>
<xsl:variable name="string-value">
<xsl:apply-templates select="contents"/>
</xsl:variable>
<fo:table-cell border="solid black 1 px" border-collapse="collapse">
<xsl:for-each select="$contents[not(.='null')">
<fo:block>
<xsl:value-of select="."/>
</fo:block>
</xsl:for-each>
</fo:table-cell>
</xsl:template>Cheers, Wendell
Any more suggestions.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_ "Thus I make my own use of the telegraph, without consulting the directors, like the sparrows, which I perceive use it extensively for a perch." -- Thoreau
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Noob: hmm using nested te, David Carlisle | Thread | Re: [xsl] Noob: hmm using nested te, Barry van Weldam |
| [xsl] how to escape backslash apost, Derrick Koes | Date | RE: [xsl] determining if one or mor, SANWAL, ABHISHEK (HP |
| Month |