This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: problem with xsl:choose
- To: "Student1 ASCO-ELK (RBJE/ELK)" <Student1 dot ASCO-ELK at jp dot bosch dot com>
- Subject: Re: [xsl] problem with xsl:choose
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Fri, 25 May 2001 11:33:13 +0100
- CC: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Organization: Jeni Tennison Consulting Ltd
- References: <672DE6F29149D411AB1800508BCF9D7A0247F63C@SIKMAIL>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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