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

Subject: Re: [xsl] Start and end an anchor tag in 2 different if's?
From: "Werner, Wolfgang" <mail@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 05 Oct 2004 18:19:21 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You could use
	<xsl:text disable-output-escaping='yes'>&lt;a&gt;</xsl:text>
instead of <a> and
	<xsl:text disable-output-escaping='yes'>&lt;/a&gt;</xsl:text>
instead of </a> but I would _not_ recommend this approach since you can
accidentally create non-wellformed documents pretty easy this way.
You basically trick the XSLT processor to output text that looks like
xml without recognizing its xml.

Regards,
Wolfgang



Hardy Merrill wrote:
| Given this snippet from an XSL style sheet:
| ----------------------------------------------------------
|
| 	<xsl:if test="district_active='1'">
| 		<a>
| 			<xsl:attribute name="href">LegislatorEdit.asp
| 				?lid=<xsl:value-of
| select="legislator_id" />
| 				&amp;lstat=<xsl:value-of select="$lstat"
| />
| 				&amp;dtype=<xsl:value-of select="$dtype"
| />
| 				&amp;dno=<xsl:value-of select="$dno" />
| 			</xsl:attribute>
| 	</xsl:if>
| 				
| 	<xsl:choose>
| 		<xsl:when test="substring(full_name,1,6) = 'Vacant'">
| 			<xsl:value-of select="'Vacant'" />
| 		</xsl:when>
| 		<xsl:otherwise>
| 			<xsl:value-of select="full_name" />
| 		</xsl:otherwise>
| 	</xsl:choose>
| 						
| 	<xsl:if test="district_active='1'">
| 		</a>   <!--============ Notice this ==============-->
| 	</xsl:if>
|
| ------------------------------------------------------------------------
|
| Can't the first if-test start an <A> tag, and the 2nd if-test end it
| with </A>?  I want to start the anchor, then fill in the display text
| based on a choose, and then end the anchor.
|
| When I try this I get this error
|
| msxml4.dll error '80004005'
| The stylesheet does not contain a document element. The stylesheet may
| be empty, or it may not be a well-formed XML document.
|
| Is there something obvious that I'm doing wrong?
|
| TIA.
|
| Hardy Merrill
|
|
|

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBYsmJqjaicDyx8o8RAh1cAJ9JPVlq/Q/2FfS8OjdnreYHlGjWOwCfe0uL
LMyOAl+Oh3MUvga9R40lSYA=
=l0Mc
-----END PGP SIGNATURE-----

Current Thread