Subject: Re: [xsl] data translation => descendants appear side by side in HTML-table From: Joerg Heinicke <joerg.heinicke@xxxxxx> Date: Sat, 04 May 2002 14:30:24 +0200 |
<xsl:variable name="desc1" select="/root/base[1]//description"/> <xsl:variable name="desc2" select="/root/base[2]//description"/>
<xsl:call-template name="description-row"> <xsl:with-param name="count" select="$count"/> </xsl:call-template>
</table> </body> </html> </xsl:template>
<xsl:template name="description-row"> <xsl:param name="index" select="1"/> <xsl:param name="count" /> <tr> <td><xsl:value-of select="$desc1[$index]"/></td> <td><xsl:value-of select="$desc2[$index]"/></td> </tr>
<xsl:if test="$index < $count"> <xsl:call-template name="description-row"> <xsl:with-param name="index" select="$index + 1"/> <xsl:with-param name="count" select="$count"/> </xsl:call-template> </xsl:if> </xsl:template>
>----- Answer ----- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<!-- Variables containing description elements in each base element. Use top-level variables for efficiency, so they don't have to be passed into templates --> <xsl:variable name="desc1"> <xsl:apply-templates select="/root/base[1]"/> </xsl:variable> <xsl:variable name="desc2"> <xsl:apply-templates select="/root/base[2]"/> </xsl:variable>
<!-- make copy of all description elements within base --> <xsl:template match="base"> <xsl:copy-of select=".//description"/> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] data translation => desce, Stuart Celarier | Thread | [xsl] xpath - how to return all nod, Scott Zagar |
RE: [xsl] xml to xml with a xmlns s, Julian Reschke | Date | Re: [xsl] data translation => desce, Joerg Heinicke |
Month |