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

Re: Re: Template match via xsl:param

Subject: Re: Re: Template match via xsl:param
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Tue, 15 Jan 2002 02:25:55 -0800 (PST)
param template match
> > Can anyone give me a simple example on how to achieve this without
> > genereting the xsl file on the fly?
> 
> You can't, I'm afraid.
> 
> If the $path parameter only specifies an element name, then what you
> could do is change the xsl:include to an xsl:import, and have the
> following template, which matches all elements, and goes on to process
> them with whatever's supplied in identity.xsl unless their name is the
> same as the $path parameter:
> 
> <xsl:template match="*">
>   <xsl:if test="name() != $path">
>     <xsl:apply-imports />
>   </xsl:if>
> </xsl:template>
> 
> If the $path is a more complex path, you could extend this solution to
> do more elaborate checks on the identity of the element (rather than
> just looking at its name) before going on to process it (or not).
> 
> Because of predicates, trying to implement a path pattern matcher in
> XSLT is just as hard as trying to implement an XPath evaluator in
> XSLT. But then probably the patterns that you're actually using are a
> subset of the patterns that would be allowed in the match attribute,
> so you might be able to make it work.
> 
> Otherwise, as you say, you need to generate the XSLT stylesheet on the
> fly.


There's an option not to ***generate*** a stylesheet, but to use a single stylesheet
and set the value of the "select" attribute of a given xsl:variable or xsl:param to
the desired XPath expression. Once this is done (e.g. via DOM), then the
transformation may be applied.

This is essentially how the XPath Visualiser works.

Cheers,
Dimitre Novatchev.



__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.