|
Subject: Re: [xsl] create escaped(?) html of some nodes From: Florent Georges <darkman_spam@xxxxxxxx> Date: Tue, 10 Oct 2006 10:29:13 +0200 (CEST) |
Jan Limpens wrote:
Hi
> but I have no Idea how I can transform using
> <xsl:template match="entry:Image">
> <p class="ImageParagraph">
> <img src="{$application-path}{@href}" alt="{entry:Title}" />
> <br />
> <xsl:value-of select="entry:Description" />
> </p>
> </xsl:template>
> and escape the html (make the brackets become %lt;) as well.
You have two main options: 1/ create the nodes for resulting HTML,
then serialize them, or 2/ create directly text nodes. 1/ will looks
to something like this:
<xsl:template match="entry:Image">
<xsl:text> &_lt;p class="ImageParagraph"&_gt;</xsl:text>
<xsl:text> &_lt;img src="</xsl:text>
<xsl:value-of select="$application-path"/>
<xsl:value-of select="@href"/>
<xsl:text>" alt="</xsl:text>
<xsl:value-of select="entry:Title"/>
<xsl:text>"/&_gt;</xsl:text>
<xsl:text> &_lt;br/&_gt;</xsl:text>
<xsl:value-of select="entry:Description"/>
<xsl:text> &_lt;/p&_gt;</xsl:text>
</xsl:template>
For 2/, you have to use you prefered xx:node-set() extension or XSLT
2.0. You then create the template rules that make the escaping, in a
particular mode:
<xsl:template match="*" mode="serialize">
<xsl:text>&_lt;</xsl:text>
<xsl:value-of select="name()"/>
<xsl:apply-templates select="@*" mode="serialize"/>
<xsl:text>&_gt;</xsl:text>
<xsl:apply-templates select="node()" mode="serialize"/>
<xsl:text>&_lt;/</xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>&_gt;</xsl:text>
</xsl:template>
Or you can use your favorite serialize extension or module.
Regards,
--drkm
___________________________________________________________________________
Dicouvrez une nouvelle fagon d'obtenir des riponses ` toutes vos questions !
Demandez ` ceux qui savent sur Yahoo! Questions/Riponses
http://fr.answers.yahoo.com
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] create escaped(?) html of, Jan Limpens | Thread | Re: [xsl] create escaped(?) html of, Jan Limpens |
| Re: [xsl] create escaped(?) html of, Jan Limpens | Date | Re: [xsl] XSLT functions in XPath, Victor Toni |
| Month |