This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Entities: The worst of both worlds :-(
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Entities: The worst of both worlds :-(
- From: "Zarella Rendon" <zarella at coolheads dot com>
- Date: Tue, 2 Oct 2001 11:15:03 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
Nicholas,
There is a way to process character entities, but it requires a bit of
hacking to get the XML parser to work for you. Take your Entity declaration
files and create a new set that you will use just for transformation
purposes. Each entity will need to be modified to have the form:
<!ENTITY tilde "<ent>&tilde;</ent>">
Now, this will create new <ent> elements in your XML file before it gets to
the XSLT processor. So, in XSLT, you can now use a template rule as follows:
<xsl:template match="ent">
<xsl:value-of disable-output-escaping="yes" select="text()"/>
</xsl:template>
Hope this helps.
---
Zarella Rendon, Principal Consultant
HMM Consulting International, Inc.
DTDs/schemas - conversion - ebooks - publishing - Web - B2B - training
zarella@hmmci.com
http://www.hmmci.com/
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Nicholas
> Waltham
> Sent: Monday, October 01, 2001 12:13 PM
> To: xsl-List@lists.mulberrytech.com
> Subject: [xsl] Entities: The worst of both worlds :-(
>
>
> Hello All,
> I am really having some trouble with entities.
>
> I have an XSL which translates from one form of XML to another, I
> would like
> to preserve the
> entities in XML, but unfortunately, they are translated on the
> way, so they
> appear as the extented
> characters in the XML. I would like to keep them as entities in the target
> XML. How do I do this?
>
> Secondly, if I include enties in the XSL, they stay as entities
> in the final
> output.
>
> Looking at this example
>
> <xsl:template match="escape" mode="Body"><!--Dump all extra spaces-->
> <xsl:text>&</xsl:text><xsl:value-of
> select="@entval"/><xsl:text>;</xsl:text>
> </xsl:template>
>
>
> I would like the final XML to have
>
> "
>
> in for example, if the enval attribute is quot, however in the
> output XML I
> get
>
> &quot;
>
> :-(
>
> Any help would be appreciated!!!
>
> Thanks in advance,
> Nicholas Waltham
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list