You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Dmitry Volpyansky <dv...@webstreetsecurities.com> on 2000/01/18 22:09:24 UTC

HTML entities

I'm not sure if this is an appropriate place for these types of questions,
so forgive me if its not.  I am using Xalan0.19.2/Xerces1.0.1 on Solaris
2.7, jdk1.2

I am trying to generate multi-language HTML files from inbound XML requests
and pre-created XSL stylesheets.

The inbound XML contains an Element or Attribute, languageCode, that is used
to choose which human language to use in the resulting HTML (en_US, de_DE,
etc)

Currently, I've implemented the code something like this (caching and error
checking disabled):

    create memory buffer
        read FOO.xsl
        find processing instruction <?Dmitry InsertEntitiesHere?> line
            read and insert HTML.xsl  (question 2)
            read and insert appropriate languageCode.xsl (question 1)
     stylesheet = new stylesheet(memory_buffer)
     stylesheet.process(xml, memory_buffer, html_output)

I think that there's got to be a better way to do localization in XSL, and
that I am just missing it.

So with that in mind, here are my questions

-----

1.  What is a good way to use language-specific !ENTITY's?

For example, in file English.xsl, I have

    <!ENTITY greeting "Hello">

And in file Spanish.xsl I have

    <!ENTITY greeting "Hola">


How can I, AT RUNTIME, include or import either the English or the Spanish
entities based on the request in my XML file?


2. Additionally, is there a way to automatically include all the official
HTML entities into a stylesheet?

For example, I currently have to include the following (HTML.xsl) into my
stylesheets, using the technique stated above:

    <!ENTITY nbsp   "&#160;">
    <!ENTITY iexcl  "&#161;">
    <!ENTITY cent   "&#162;">
    <!ENTITY pound  "&#163;">
    <!ENTITY curren "&#164;">
    ....
    ....
    <!ENTITY yuml   "&#255;">

3.  Finally, is there a way do the following without causing a recursive
error?  It could be useful to allow the pass-through of entities to the
output stream, instead of processing them.

    <!ENTITY nbsp   "&nbsp;">
instead of
    <!ENTITY nbsp   "&#160;">

Thank you,

Dmitry Volpyansky