Hi,
I noticed I didn't phrase my problem carefully enough (and the example
wasn't correct either - thank's David) - probably too late at night:
I want to convert only certain (html) nodes using a generic template,
but have to pass a parameter to these templates. As the nodes may be
nested within othernodes, I am using the generic copy 'function'
<xsl:template match="@*|node()|text()" priority="-1">
<xsl:param name="path" select="'zz'"/>
<xsl:copy>
<xsl:apply-templates select="@*|node()|text()">
<xsl:with-param name="path" select="$path"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
The more specific template is:
<xsl:template match="/content">
<test>
<xsl:apply-templates select="para">
<xsl:with_param name="path" select="docBase"/>
</xsl:apply-templates>
</test>
</xsl:template>
and the element I want to change:
<xsl:template match="a/@href">
<xsl:param name="path" select="'xx'"/>
<xsl:attribute name="href"><xsl:value-of select="$path"/>
<xsl:value-of select="."/></xsl:attribute>
</xsl:template>
A sample xml file could be:
<content>
<para>
<docBase>full_path_to_some_directory</docBase>
This is a test <b>text</b> which should be copied 1:1.
<a href=3D"local_ref">A reference</a>
<center><a href=3D"local_ref">A nested reference</a></center>
</para>
<para>
<docBase>next_full_path_to_some_directory</docBase>
This is a test <b>text</b> which should be copied 1:1.
<a href=3D"local_ref">A reference</a>
<center><a href=3D"local_ref">A nested reference</a></center>
</para>
</content>
I want to use the <docBase> in every <para> to modify the href
of each anhor element.
How can I propagate the parameter's value in the more specific
template into the generic template? The only parameter that is
propagated is the one in the generic template, so all references have
a value of zz...
Thanks in advance, Robert
Departement Informatik FGB tel +41 (0)61 267 14 66
Universität Basel fax. +41 (0)61 267 14 61
Robert Frank
Klingelbergstrasse 50 Robert(_dot_)Frank(_at_)unibas(_dot_)ch
CH-4056 Basel
Switzerland http://
www.informatik.unibas.ch/personen/frank_r.html
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--