[xsl] <br /> tag is condensed to <br> despite valiant efforts to avoid this...

Subject: [xsl] <br /> tag is condensed to <br> despite valiant efforts to avoid this...
From: "Frank T. O'Connor" <foconnor@xxxxxxxxxxxx>
Date: Wed, 7 Mar 2001 11:13:17 -0500
Using MSXML3.

Here is my catch all for moving XHTML over from a xml node to the HTML
output during a transform:

<xsl:template match="*">
   <xsl:element name="{name()}">
     <xsl:copy-of  select="@*"/>
     <xsl:apply-templates select="node()"/>
  </xsl:element>
</xsl:template>

When this catches the br tag (all my br's are <br />) it moves it to the
HTML output as <br>. As that is not XHTML compatible it causes me havoc
later on.

I tried this:
<xsl:template match="*">
  <xsl:choose>
	<xsl:when test="name() = 'br'">
	  <![CDATA[<br />]]>
	</xsl:when>
	<xsl:otherwise>
	   <xsl:element name="{name()}">
	     <xsl:copy-of  select="@*"/>
	     <xsl:apply-templates select="node()"/>
	  </xsl:element>
	</xsl:otherwise>
  </xsl:choose>
</xsl:template>

But I only get "&lt;br /&gt;" in the output then.

Appreciate any help.

-Frank O'Connor

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread