Re: [xsl] Is it possible to access a tag after using apply-templates?

Subject: Re: [xsl] Is it possible to access a tag after using apply-templates?
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Fri, 04 Jul 2008 16:28:03 +0200
Martin Honnen wrote:
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.

If you need/want to use XSLT 1.0 then you need to make sure you pass parameters explicitly on in all templates that are used, in particular that identity transformation template:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl=""; version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:variable name="data" select="/"/>
<xsl:variable name="layout"
<xsl:template match="/">
<xsl:apply-templates select="$layout/layout/layout-main/*"/>
<!-- transformations -->
<xsl:template match="insert-name">
<xsl:value-of select="$data/top/data/name"/>
<xsl:template match="insert-title">
<xsl:value-of select="$data/top/data/title"/>
<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"/>
<xsl:with-param name="value" select="$value"/>
<xsl:template match="insert-cell-name">
<xsl:param name="name"/>
<xsl:value-of select="$name"/>
<xsl:template match="insert-cell-value">
<xsl:param name="value"/>
<xsl:value-of select="$value"/>
<!-- Identity transformation -->
<xsl:template match="@*|node()">
<xsl:param name="name"/>
<xsl:param name="value"/>
<xsl:apply-templates select="@*|node()">
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="value" select="$value"/>


	Martin Honnen

Current Thread