[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Executing an alternate template if select="somepath" r
I have a relatively simple question. I've already found a solution that works for my current situation but I'm looking for a more general solution. In my XSL, I originally had the following: ... <xsl:apply-templates select="library/playlist[@current='current']" /> ... <xsl:template match="library/playlist[@current='current']">... </xsl:template> Which isn't really all that big a deal (ok, it may be redundant the way its written but its actually someone else's code). But I need to be able to call a different template when there is no playlist with the attribute current equal to current. In this case, the stuff that needed to be done if there wasn't the playlist happened to also be in the template that executes when there is a playlist so I rewrote the code to be ... <div id="used_to_be_in_the_template"> <xsl:apply-templates /> <xsl:call-template name="common" /> </div> ... <xsl:template match="playlist[@current='current']">... </xsl:template> <xsl:template name="common">... </xsl:template> (since there is no other template that will match a playlist, this works fine, otherwise a simple mode will fix it) But what I want to know is whether there is a way to ensure that if the select returns no nodes that template foobar gets called. I know that I could use a choose/when/otherwise approach but it seems inelegant to me. Thanks everyone. > Adam van den Hoven > Internet Application Developer > Blue Zone > tel. 604.685.4310 > fax. 604.685.4391 > > Blue Zone makes you interactive. http://www.bluezone.net/ > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! 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
|