This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Marking up a simple "and" condition in Boolean operations
- To: XSL-List at mulberrytech dot com
- Subject: Marking up a simple "and" condition in Boolean operations
- From: bryan dot s dot schnabel at exgate dot tek dot com
- Date: Wed, 19 Jul 2000 15:24:42 -0700
- Reply-To: xsl-list at mulberrytech dot com
Hello experts,
I am trying to perform what ought to be a simple Boolean operation, but I
can't find the answer to this (maybe I'm not looking hard enough). How do I
mark up a simple *and*?
Input:
<Graphic>
<Image>t:\common\images\t848586.gif</Image>
<Caption>NHL Hall of Fame</Caption>
<NegNumber>556688998h8</NegNumber>
</Graphic>
DTD:
<!ELEMENT Graphic ((Image | URL),Caption?,NegNumber?) >
As you see. I might have an instance with Image or URL, and a NegNumber, or
I might have and instance with Image or URL, but no NegNumber. I want to
code for Image and NegNumber, or Image no NegNumber.
My attempt:
<xsl:template match="Graphic">
<xsl:choose>
<xsl:when test="URL">
<Graphic URL ="{./URL}">
<xsl:apply-templates/>
</Graphic>
</xsl:when>
<xsl:when test="Image"> <!-- I need an "and
NegNumber" test here -->
<Graphic Image ="{./Image}" NegNumber="{./NegNumber}">
<xsl:apply-templates/>
</Graphic>
</xsl:when>
<xsl:when test="Image">
<Graphic Image ="{./Image}">
<xsl:apply-templates/>
</Graphic>
</xsl:when>
<xsl:when test="Negnumber">
<Graphic NegNumber ="{./NegNumber}">
<xsl:apply-templates/>
</Graphic>
</xsl:when>
<xsl:otherwise>
<Graphic>
<xsl:apply-templates/>
</Graphic>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Thanks,
Bryan Schnabel
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list