Re: XSL html entities
"Michael Kay" <[email protected]> Thu, 11 Dec 2008 09:18:29 -0000
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <93F83AC8631545A4B5C89A8E9C8BB21E@Sealion> |
You can call the template like this:
<xsl:variable name="after-replacement">
<xsl:call-template name="SEARCH-AND-REPLACE">
<xsl:with-param name="string" select="$in"/>
<xsl:with-param name="search-for" select="&lt;"/>
<xsl:with-param name="replace-with" select="<"/>
</
</
Michael Kay
http://www.saxonica.com/
_____
From: [email protected]
[mailto:[email protected]] On Behalf Of Atul Shinh
Sent: 11 December 2008 06:09
To: [email protected]
Subject: [exslt] XSL html entities
Hi all,
I am facing an problem with HTML entities in XSL processing. My XML file
contains HTML entities like ">", "<" (without quotes). So when I try
to produce an PDF from this XML using an XSL file these entities are getting
output as such, not being rendered as (< , >).
So I tried using string-replace enhanced template
===================================================
<xsl:template name="SEARCH-AND-REPLACE">
<xsl:param name="string" />
<xsl:param name="search-for" />
<xsl:param name="replace-with" />
<xsl:choose>
<xsl:when test='contains($string,$search-for)'>
<xsl:call-template name="SEARCH-AND-REPLACE">
<xsl:with-param
name="string"
select='concat( substring-before($string,$search-for),
$replace-with, substring-after($string,$search-for) )' />
<xsl:with-param name="search-for" select="$search-for" />
<xsl:with-param name="replace-with"
select="$replace-with" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
======================================================
Is this approach right ?
If yes then how can I pass $string, $search.
Regards
_______________________________________________
exslt mailing list
[email protected]
http://www.exslt.org/list