|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: how to translate entities with XSL
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








