|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Streamlining XSL and transform performance (how do
On Friday 19 March 2004 16:30, Julian Voelcker wrote:
>
> OK, a couple more questions if you can bear it...
>
> Where we have..
>
> <XSL:template match="AnswerSet">
> <xsl:apply-templates
> select="Answer[@name='ticdesc']"/> </xsl:template>
> <xsl:template match="Answer[@name='ticdesc']">
> <p><xsl:value-of select="TextValue"/></p>
> </xsl:template>>
>
> There are going to be a lot of instances when I want to be
> able to 'extract' a specific value like the value of ticdesc.
> Is there any way of making the template more versatile so that
> the name ticdesc is passed to is when the template is applied?
Unfortunatly you can't use variables in match patterns but there
is an alternative in the form of generic templates
(http://www.dpawson.co.uk/xsl/sect2/generic.html). Here is a
quick example.
<sarvega:dispatchtable>
<ticdesc name='ticdesc'/>
<female name='Female'/>
<abgrbefore name='ABGRBefore'/>
</sarvega:dispatchtable>
<xsl:template match="/">
<xsl:apply-templates
select="document('')/xsl:stylesheet/sarvega:dispatchtable/*[@name='ticdesc']"/>
</xsl:template>
<xsl:template match="ticdesc|female">
<xsl:copy-of select="."/>
</xsl:template>
Note that in the select clause in the apply templates I have
hardcoded 'ticdesc' but you can use a variable here.
>
> Also, going along the same lines, is it possible to set and
> read variables within the XSL file?
>
This is a very frequently asked question,
http://www.dpawson.co.uk/xsl/sect2/N8090.html should help.
Kev.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








