[Home] [By Thread] [By Date] [Recent Entries]
XemonerdX wrote:
Unfortunately that's not quite the result. I can't seem to be able to replace the 'insert-cell-name' and 'insert-cell-value' tags with the corresponding 'name' and 'value' tag values. Is this possible? Here is an XSLT 2.0 stylesheet making use of tunnel parameters. Using Saxon 9.0 it produces the output you have described. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="html" indent="yes"/> <xsl:variable name="data" select="/"/> <xsl:variable name="layout" select="document('test2008070402.xml')"/> <xsl:template match="/"> <xsl:apply-templates select="$layout/layout/layout-main/*"/> </xsl:template> <!-- transformations --> <xsl:template match="insert-name"> <xsl:value-of select="$data/top/data/name"/> </xsl:template> <xsl:template match="insert-title"> <xsl:value-of select="$data/top/data/title"/> </xsl:template> <xsl:template match="insert-cells"> <xsl:for-each select="$data/top/cells/cell"> <xsl:variable name="name" select="name"/> <xsl:variable name="value" select="value"/> <xsl:apply-templates select="$layout/layout/layout-cell/tr"> <xsl:with-param name="name" select="$name" tunnel="yes"/> <xsl:with-param name="value" select="$value" tunnel="yes"/> </xsl:apply-templates> </xsl:for-each> </xsl:template> <xsl:template match="insert-cell-name"> <xsl:param name="name" tunnel="yes"/> <xsl:value-of select="$name"/> </xsl:template> <xsl:template match="insert-cell-value"> <xsl:param name="value" tunnel="yes"/> <xsl:value-of select="$value"/> </xsl:template> <!-- Identity transformation --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> -- Martin Honnen http://JavaScript.FAQTs.com/
|

Cart



