xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Blondeau" <blond...@exoffice.com>
Subject Re: xsl question
Date Wed, 12 Apr 2000 03:44:59 GMT

Hello Michael

<stuff remove>

> I have a template that I use for all my generic html form element
> generation, so I would have the following code snippets to match the
> then forward them on to the build_element template:
> <xsl:template match="element[@name='fname']">
> <xsl:call-template name="build_element"/>
> </xsl:template>
> <xsl:template match="element[@name='lname']">
> <xsl:call-template name="build_element"/>
> </xsl:template>
> This seems so redundant (mainly because it is). Is there a wildcard that I
> could match off of so I could basically replace the 2 <xsl:template
> match...> tags above with something like:
> <xsl:template match="element[@name=*]">
> <xsl:call-template name="build_element"/>
> </xsl:template>

I think you can replace your match by only one doing :
<xsl:template match="element[@name='fname' or @name='lname']">
<xsl:call-template name="build_element"/>

If you want all the elements that have an attribute "name", just do:
<xsl:template match="element[@name]">

<stuff removed>

Hope that helps


View raw message