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

Re: problem with xsl:choose

Subject: Re: problem with xsl:choose
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Fri, 25 May 2001 11:33:13 +0100
Re:  problem with xsl:choose
Hi,

It would be very helpful if you gave an example of the output that
you're after.  But without that, I think that you want to have table
elements with a class of 'screen' for each screen element, and table
elements with a class of 'table' for each table element.  You can do
that with separate templates for the two types:

<xsl:template match="screen">
   <table class="screen" tID="{@h}">
      <xsl:call-template name="screenHdr" />
   </table>
</xsl:template>

<xsl:template match="table">
   <table class="table" tID="{@h}">
      <xsl:call-template name="tableHdr" />
   </table>
</xsl:template>

Applying templates to nodes is a good way of managing this because it
doesn't do anything unless the nodes exist in the first place.  If you
want to output something if they're not available, then you can add an
xsl:if that tests for it and emits an error as appropriate.

<xsl:template match="/">
   <xsl:apply-templates select="data/screen" />
   <xsl:apply-templates select="data/table" />
   <xsl:if test="not(data/screen or data/table)">
      error
   </xsl:if>
</xsl:template>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 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.