This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: <br /> tag is condensed to <br> despite valiant efforts to avoid this...
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] <br /> tag is condensed to <br> despite valiant efforts to avoid this...
- From: "Ciaran Byrne" <ciaran dot byrne at 3tl dot com>
- Date: Wed, 7 Mar 2001 17:01:30 -0800
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Frank,
Try
<xsl:template match="*">
<xsl:element name="{name()}">
<xsl:copy-of select="@*"/>
<xsl:if test="child::node()">
<xsl:apply-templates/>
</xsl:if>
</xsl:element>
</xsl:template>
which will not apply-templates if the <br/> has no children.
If the element is empty <br></br> it should be reduced to <br/>
-----Original Message-----
From: owner-xsl-list@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Frank T.
O'Connor
Sent: Wednesday, March 07, 2001 8:13 AM
To: XSL-List@lists.mulberrytech.com
Subject: [xsl] <br /> tag is condensed to <br> despite valiant efforts
to avoid this...
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 "<br />" in the output then.
Appreciate any help.
-Frank O'Connor
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list