<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:lookup="my:lookup"
exclude-result-prefixes="lookup">
<lookup:element
temporary-directory="/var/temp"
search-local-classes-first="false"
/>
<xsl:template match="node()">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*">
<xsl:copy-of select="."/>
<xsl:copy-of select="document('')/*/lookup:element/@*
[name() = name(current())]"/>
</xsl:template>
</xsl:stylesheet>
Note: it is necessary to use elements instead of attributes in the
lookup, if the substitution values can be changed as result of
attribute normalization.
I just wanted to be different here :o)
Cheers,
Dimitre.
On Fri, 12 Nov 2004 15:57:46 -0500, Ann Marie Rubin
<annmarie(_dot_)rubin(_at_)sun(_dot_)com> wrote:
Hello List,
I have a stylesheet that defines 2 global parameters: attr and value.
The stylesheet has a template that matches all attributes, and if the
current attribute name matches the global attr, outputs value.
<xsl:template match="@*" priority="10">
<xsl:attribute name="{name()}">
<xsl:choose>
<xsl:when test="name()=$attr"><xsl:value-of
select="$value"/></xsl:when>
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:template>
Requirements have changed and now the calling process will parse the
stylesheet to write a set of global parameters for the values that need
to be updated, like so:
<xsl:param name="attr">temporary-directory</xsl:param>
<xsl:param name="value">/var/temp</xsl:param>
<xsl:param name="attr1">search-local-classes-first</xsl:param>
<xsl:param name="value1">false</xsl:param>
.
.
.
Is there a way to loop through the global attributes and call the
template for each one?
Thanks,
Ann Marie
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--