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

Re: Start and end an anchor tag in 2 different if's?

Subject: Re: Start and end an anchor tag in 2 different if's?
From: JBryant@xxxxxxxxx
Date: Tue, 5 Oct 2004 11:13:10 -0500
xsl attribute anchor
That never works. XML enforces strict nesting, so both the closing and 
ending tags for a child element have to be within the parent element. 
Remember that an XSL stylesheet is also an XML document.

I agree that it would sometimes be handy, but then it wouldn't be XML.

Instead, you need something like this:

<xsl:if test="district_active='1'">
  <xsl:choose>
    <xsl:when test="substring(full_name,1,6) = 'Vacant'">
      <a>
        <xsl:attribute name="href">stuff</xsl:attribute>
        <xsl:value-of select="'Vacant'" />
      </a>
    </xsl:when>
    <xsl:otherwise>
      <a>
        <xsl:attribute name="href">stuff</xsl:attribute>
        <xsl:value-of select="full_name" />
      </a>
    </xsl:otherwise>
  </xsl:choose>
</xsl:if>

Disclaimer: I rearranged that pretty quickly, so it may be off a bit, but 
I trust it gives the idea. Also, I truncated the attribute content just to 
make this snippet more readable.

Happy coding.

Jay Bryant
Bryant Communication Services

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.