xsl-list
[Top] [All Lists]

RE: Using HTML entity codes within XSL?

2002-12-18 11:15:32
1) The pre-defined entities in an XML document are found here: 
http://www.w3.org/TR/REC-xml#syntax

2) Either:

<xsl:template match="/">
  <html>
  <body>
        &#163;<xsl:value-of select="data/premiumAmount" />
  </body>
  </html>
</xsl:template>

Or, if you think you will use it more than once...

<!DOCTYPE xsl:stylesheet [
  <!ENTITY pound "&#163;">
]>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">

<xsl:template match="/">
  <html>
  <body>
        &pound;<xsl:value-of select="data/premiumAmount" />
  </body>
  </html>
</xsl:template>

Etc


Rgs,

Ben


-----Original Message-----
From: Richie B [mailto:richie(_at_)musicplace(_dot_)screaming(_dot_)net] 
Sent: 18 December 2002 17:52
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Using HTML entity codes within XSL?


Hi,
        I'm trying to do something like the following in XSL:

<xsl:template match="/">
  <html>
  <body>
        &pound;<xsl:value-of select="data/premiumAmount" />
  </body>
  </html>
</xsl:template>

I'd like to output HTML character entities to a browser, so that the browser 
will render the correct character internally, independent of the user's set-up, 
rather than having to use something like a pound symbol "£" for the Latin-1 
character set - but I obviously get an error if I try to use "&pound;" within 
the XSL ("Reference to undefined entity 'pound'.").  The solution at 
http://www.dpawson.co.uk/xsl/characters.html
says to specify the character set, but this would defeat the purpose, and also 
systems aren't required to understand any encodings other than UTF-8 and 
UTF-16.  Is there a way I can, in some form, use something like "&pound;" or 
another character reference (such as "&eacute;") in my XSL without specifying a 
specific character set/number to use?  Also, I've noticed I can already use 
certain codes such as "&amp;" and "&gt;" - is there a list of defined codes 
which can be used in XSL?

Thanks,
Rich





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>