|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: arbitrary depth element type conversion
Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> wrote: > Sebastian, > > In addition to what David said, consider the following more succinct > version of your algorithm: > > <xsl:template match="document"> > <xsl:apply-templates/> > </xsl:template> > > <xsl:template match="*"> > <div class="{name()}"> > <xsl:apply-templates/> > </div> > </xsl:template> > > It does the same thing the same way. I often encourage newcomers to > try writing things the long way, as it makes things more > explicit. Here, the difference between the long way and the short way > (using literal result elements and an attribute value template instead > of xslt instructions for everything) is so dramatic, I thought it > worthwhile making the opposite recommendation. > > In particular (in the context of the question you first raised), note > that no explicit statement requesting any values (i.e., any data > content) is here, or called for -- look ma, no value-of -- in either > this version or yours (as corrected by DC). That's because it's using, > instead, the built-in template for text nodes, which looks like this, > and which will fire, since you have nothing to override it: > > <xsl:template match="text()"> > <xsl:value-of select="."/> > </xsl:template> > > Trusting that this will work and getting the hang of "letting it > happen" in XSLT's template-matching processing model is often an early > hurdle, higher for some learners than others. > > Cheers, > Wendell Thank you all. We're just not used to having things done for us are we! sdt
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Cast Your Vote
We need your help – Vote for DataDirect XML Products!
Winners and finalists announced at SOA World Conference in November. 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
|







