[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] usage of entities (for dummies)


Subject: [xsl] usage of entities (for dummies)
From: "Georg Hohmann" <georg.hohmann@xxxxxxxxx>
Date: Thu, 3 Aug 2006 11:45:13 +0200

I'm bothering with the usage of entities. I found myself starring a
long time at the definiton of entities and the xslt-faq but without
getting a glimpse how to solve a problem i will describe in the
following.

I have to replace occurences of something like this "^12" (a custom
placeholder) with a special character, for example a cedilla
(http://en.wikipedia.org/wiki/Cedilla). Therefore i use Michael's
"identity template" in combination with this replace function:
<xsl:value-of select="replace(., '\^12', '&ccedil;')"/>

Many questions arise around this approach (at least for me):
1.) If i use the above i get "the entity is not declared", but when i
use "&amp;" instead of the cedilla everything works fine. How do i
know which entities are declared by default and which not? How can i
declare an entity of my own?
2.) What is the difference of the usage of - for example - "&amp;" and
"&#38;"? When do i have to use the one and not the other?
3.) And where can i find a good overview of enitites?

Finally i have also a non-entity question:
I have to replace many of equivalent placeholders in the same text
too. Do i have to nest replace-functions for each of them in one
another like ...
<xsl:value-of select="replace(replace(., '\^12', '&ccedil;'), '\^13',
'&amp;')"/>
... or is there a more elegant solution for this?

Well, that are many questions, but also answers to a few of them could
help me out.

Regards,
Georg


Current Thread