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

RE: template matching

Subject: RE: template matching
From: Peter Flynn <pflynn@xxxxxx>
Date: Fri, 06 Feb 2004 14:04:01 +0000
no template provided
On Thu, 2004-02-05 at 15:52, Varley, Roger wrote:
> > 
> > On Wed, 2004-02-04 at 14:51, Varley, Roger wrote:
> > > > 
> > > > <xsl:template match="//note">
> > > >   <li>
> > > >     <xsl:apply-templates/>
> > > >   </li>
> > > > </xsl:template>
> > > > 
> > > 
> > > Oh rats! Just when I thought I'd got my head around XSLT. 
> > 
> > Gin and tonic required?
> > 
> > > Would you explain why this works, in particular why it prints only
> > > the values of the <note> elements 
> > 
> > Because that's what it says it will do. The template
> > will match every note in the document, at any depth
> > or location, and for each one, output a LI element
> > containing the value of the note.
> 
> Sorry - I wasn't being very clear. I was suprised to get output without an <xsl:value-of select="."/>

The default (in the absence of any matching template) is to output the
content. value-of is useful for out-of-line processing, or putting a 
value in more than one place in the output tree, or handling attributes.
It's not needed when all you want is the default: the character data
content.

> > 
> > > and no blank lines for the <sub1> <sub2 .... elements 
> > 
> > Because there's nothing there to do that. Where did you
> > want space to appear? 
> > 
> 
> I was expecting the standard default template to be invoked for the <sub1> <sub2> elements because there is no template provided to match them.

What is the "standard default template" you refer to? If you mean the
one I just mentioned, then it *is* being invoked...just that there is
nothing to output, only further elements to match.

///Peter



 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.