[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Noob: hmm using nested templates, how do i get the nod

Subject: Noob: hmm using nested templates, how do i get the nodes within
From: "Barry van Weldam" <barry@xxxxxxx>
Date: Thu, 18 Sep 2003 10:38:14 +0200
xsl nested templates
Hi there,

I think i know the general idea but i can't get it working.

Sorry for the long post

Part of the xml-file (i didn't format it and i replaced the node names)
-------------------------------------
<Table>
<Row>
<aaa>Total</aaa>
<TdD>null</TdD>
<NA>45678</NA>
<FR>45644</FR>
</Row>
<Row>
etc

And my workig .xsl that isn't effecient enough
=--------------------------------------------
<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>

<fo:table-cell border="solid black 1 px" border-collapse="collapse">
<fo:block>
<xsl:choose>
<!--Here we put nothing if nodevalue=null -->
<xsl:when test='(aaa="null")'></xsl:when>
<xsl:otherwise><xsl:value-of select="aaa"/></xsl:otherwise>
</xsl:choose>
</fo:block> 
</fo:table-cell>
<fo:table-cell border="solid black 1 px" border-collapse="collapse">
<fo:block>
<xsl:choose>
<!--Here we put nothing if nodevalue=null -->
<xsl:when test='(TdD="null")'></xsl:when>
<xsl:otherwise> <xsl:value-of select="TdD"/></xsl:otherwise>
</xsl:choose>
</fo:block> 
</fo:table-cell>
<fo:table-cell border="solid black 1 px" border-collapse="collapse">
<fo:block>
<xsl:choose>
<!--Here we put nothing if nodevalue=null -->
<xsl:when test='(NA="null")'></xsl:when>
<xsl:otherwise><xsl:value-of select="NA"/></xsl:otherwise>
</xsl:choose>
</fo:block> 
</fo:table-cell>
<fo:table-cell border="solid black 1 px" border-collapse="collapse">
<fo:block>
<xsl:choose>
<!--Here we put nothing if nodevalue=null -->
<xsl:when test='(FR="null")'></xsl:when>
<xsl:otherwise> <xsl:value-of select="FR"/></xsl:otherwise>
</xsl:choose>
</fo:block> 
</fo:table-cell>
etc.

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>

<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:choose>
<xsl:when test="not($cell = 'null')">
<xsl:value-of select="$cell"/>
</xsl:when>
</xsl:choose>
</fo:block>
</fo:table-cell>

</xsl:template>


Any more suggestions.


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.