|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Marking up a simple "and" condition in Boolean operations
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
|
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
|

Cart








