|
Subject: Re: how to translate entities with XSL From: Mike Brown <mike@xxxxxxxx> Date: Thu, 8 Jun 2000 15:19:12 -0600 (MDT) |
> I know this is probably bad form, but this is the way I get the xml.
> There isn't an easy way to change this.
OK.
> disable-output-escaping works if the symbols aren't already escaped in the
> xml itself. For instance, if I use the following xml and xsl, I get:
>
> output test <br/> this should be on the next line
>
> instead of:
>
> output test
> this should be on the next line
>
> [xml with "output test <br/> this should be on the next line"]
> [xsl that copies it with output escaping disabled]
What you are getting is what you asked for. Do you want to get rid of the
5 characters < b r / > entirely, replacing them with a single newline
character, mimicking the behavior of an HTML processor? (Not completely
accurate, as surrounding whitespace factors in..)
If so, then instead of value-of @html, use apply-templates @html, with
this derivative of a Michael Kay contribution to the FAQ:
<xsl:template match="@html">
<xsl:call-template name="break"/>
</xsl:template>
<xsl:template name="break">
<xsl:param name="text" select="."/>
<xsl:variable name="br" select="'<br/>'"/>
<xsl:choose>
<xsl:when test="contains($text,$br')">
<xsl:value-of select="concat(substring-before($text,$br),'
')"/>
<xsl:call-template name="break">
<xsl:with-param name="text" select="substring-after($text,$br)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: how to translate entities with , Chris Purvis | Thread | Newbie Question: Using Servlets, JS, Helge Luethje |
| RE: xml to xml identity transforms,, Sebastian Rahtz | Date | RE: multilanguage support easily or, Kevin Williams |
| Month |