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

Re: super basic xsl question

Subject: Re: super basic xsl question
From: Jeb Boniakowski <jeb@xxxxxxxxxxx>
Date: Thu, 13 Jan 2005 13:10:00 -0500
jeb boniakowski

Thanks for the reply. This is the kind of info I'm having a hard time getting from like w3schools.com, etc.

In this particular case, though, I want the template that matches the value of <child> to be agnostic to the markup that is in there, with no more template processing, I just want whatever was already done (by this point, that chunk of xml has been processed by other sheets, and will be processed by later sheets) so I didn't want to do an explicit match for the link tag.

In general though, on the topic of apply-templates, there is a larger issue that trips me up. Oftentimes, it seems that I mess up my set of templates in such a way that things get matched and copied to the output tree automatically, even though they are matched. To deal with this, I've been sticking a template at the top of my sheets that is:

<xsl:template match="text()"/>

Is this bad style? Is it a crappy hack to deal with messed up templates? Or is it the correct way to suppress default rules?

I have situations where I have things along the lines of:


When I do something like:

<xsl:template match="node">
  <h1><xsl:value-of select="description"/></h1>

<xsl:template match="node/datum">
 <li><xsl:value-of select="."/></li>

I end up with:

Foo  <!-- Extraneous foo that I don't want -->

Tacking a <xsl:template match="text()"/> seems to catch the 'Foo' and kill it, but why do I have to do this? Does the <apply-templates/> in node automatically copy the text values of any child nodes that are not explicitly matched? If so, why? Is it better to have an additional template that specifically matches 'description' and does nothing? Or to take the <h1><xsl:value-of select="description"/></h1> out and move it into this explicit template? Or should I be doing something more like <xsl:apply-templates select="datum"/>?

Again, thanks.


Current Thread


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.
First Name
Last Name
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.