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

Use of moded templates?

Subject: Use of moded templates?
From: Mark Lundquist <ml@xxxxxxxxxxxxxx>
Date: Wed, 7 Apr 2004 08:43:19 -0700
ken lundquist
Hi,

I've got a node set that's selected by an ugly, gnarly Xpath expression... let's call that the "outer" node set. Those nodes, in turn, contain the nodes that I need to transform  let's call those the "inner" node set. Everything else is to be filtered out of my transformation.

I don't want to have to repeat the hairy Xpath expression in the template that matches the "inner" nodes, so I used a mode that lets me match these nodes just by their name. The mode keeps the template from being applied to nodes that would otherwise match, i.e. nodes outside the "outer" nodes.

For example (XHTML):

	<xsl:template match="really-hair-xpath-expresssion">	<!-- outer -->
		.
		.
		<xsl:apply-templates select="li" mode="process" />	<!-- inner -->
		.
		.
	</xsl:template>

	<!-- inner -->
	<xsl:template match="li" mode="process">
		.
		.
	</xsl:template>

Once again, the idea here is to avoid having to write the second template with

match="really-hairy-xpath-expression/li"

I get the feeling that this situation must come up all the time, but... (a) This is the first time I recall having to solve this problem, and (b) I haven't seen it mentioned as a typical application in explanations of moded templates. All that makes me feel like I'm missing something, or like I've solved this before in some different way. Is there a "right way" to do this? Is this a normal use for moded templates?

Thanks,
mark

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.