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

Re: template match question

Subject: Re: template match question
From: "Marrow" <marrow@xxxxxxxxxxxxxx>
Date: Fri, 2 Aug 2002 17:14:58 +0100
xsl template match b
Hi Sandy,

><xsl:template match="b[c]"/>

Should work - when you say 'fails' what happens... and error message or
unexpected output?

If it is unexpected output then it is possibly due to your stylesheet
encountering built-in rule templates (see
http://www.w3.org/TR/xslt#built-in-rule )


><xsl:template match="b[//c]"/>

Will match a <b> element whenever there is a <c> anywhere in the XML.

Cheers
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator



-----Original Message-----
From: Sandy McArthur <sandymac@xxxxxxx>
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Date: 02 August 2002 17:06
Subject:  template match question


>I'm having trouble figuring out how to have two templates that match the
>same element but differ based on if a child elements exists.
>
>Source fragment:
>
><a>
>  <b>
>   <c>
>     foo
>   </c>
>  </b>
>
>  <b>
>    bar
>  </b>
></a>
>
>I'm having trouble writing a template match for 'b' when it has a 'c'
>element. Here is what seems logical to me but won't work and any little
>varriation I come up with fails too:
>
><xsl:template match="b[c]"/>
>
>That form seems logical to me because this at least makes the template
>match but how I want it to:
>
><xsl:template match="b[//c]"/>
>
>What am I doing wrong and/or how is my thinking wrong?
>
>FYI: I'm using the Xalan that comes with the Sun 1.4 JVM on linux.
>
>Thanks,
>Sandy McArthur
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 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.