XSL html entities
"Atul Shinh" <[email protected]> Thu, 11 Dec 2008 15:36:35 +0530
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
Hi, Thanks Michael for your response. I am facing one critical issue. I am stuck in it for long time. I have an XML file, part of which looks like this ================ XML ======================== <kbs_prodgruppe_beschreibung> besonders sanft ab, ziehen sie leise ins Türschloß *< br/ > *und halten sie sicher geschlossen. <kbs_prodgruppe_beschreibung> ======================================== So instead of 'break' tag it is HTML entity for that in XML. I want to replace it with 'break' tag. Now I am trying like this =========================================== 1<xsl:variable name="after-replacement"> 2 <xsl:call-template name="SEARCH-AND-REPLACE"> 3 <xsl:with-param name="string" select="$in"/> 4 <xsl:with-param name="search-for" select="<"/> 5 <xsl:with-param name="replace-with" select="<"/> ................. ================================== So when I am write '<' as in 5th line it throws an error: XSLCmd :FATAL: element type "null" must not contain the '<' character.�H�d�1E���e So actually I feel that there is another way for replacing the HTML entities. If you or anybody else has any idea please respond. Thanks and Regards Atul On Thu, Dec 11, 2008 at 2:48 PM, Michael Kay <[email protected]> wrote: > 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