[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Streamlining XSL and transform performance (how do

Subject: Re: Streamlining XSL and transform performance (how does it actually work?)
From: Kevin Jones <kjones@xxxxxxxxxxx>
Date: Mon, 22 Mar 2004 09:31:29 +0000
sarvega transform
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.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.