[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

Subject: Marking up a simple "and" condition in Boolean operations
From: bryan.s.schnabel@xxxxxxxxxxxxxx
Date: Wed, 19 Jul 2000 15:24:42 -0700
xsl boolean operation
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


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.