[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
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|