RE: entities in XML/XSL

Subject: RE: entities in XML/XSL
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 27 Feb 1999 06:02:50 -0800
Hi Tomas!

At 99/02/26 12:17 +0100, ter@xxxxxxxxx wrote:
>Actually it is not possible to refer to entities other than the
>pre-defined without a DTD. You can use an internal DTD only specifying
>the entity declarations, but a DTD have to be present.

Not only is it my understanding that you can, indeed, do so, but I
*extensively* use general entities to parameterize my XSL stylesheets.  One
of the many uses is where I put all the text emitted by my stylesheet into
separate general entities, and in my stylesheets I use external parameter
entities with marked sections to engage the language of choice with which
my stylesheet emits various heralds and titles.

Another interesting use is to put the definition of modes and match
patterns into general entities ... in this way I can I parameterize the
stylesheet's interpretation of the source.  This allows me to take my one
XML source of my training materials and parameterize one stylesheet to emit
different slides for printing, slides for presenting from the podium, and
slides for on-line CBT.

It is important that general entities be allowed because it would be
difficult to compose the required DTD when mixing XSL instructions with
representations of the result tree.

Shown below is an example taken from my XSL training materials (from day 2
of the 2-day course).

I hope this helps.

............. Ken

p.s. I will see you in two weeks time and can show you my results 

<?xml version="1.0"?><!--entisamp.xsl-->
<!--XSL Working Draft 1998-12-16 - http://www.CraneSoftwrights.com-->
<!DOCTYPE xsl:stylesheet
[
<!ENTITY Module "Module">  <!--boilerplate text in the English language-->
<!ENTITY Lesson "Lesson">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
<xsl:template match="/">                    <!-- root rule -->
    <xsl:for-each select="module">
      <xsl:text>&Module;: </xsl:text><xsl:value-of select="title"/>
      <xsl:apply-templates select="."/>
    </xsl:for-each>
</xsl:template>
<!--
...
-->
<xsl:template match="lesson">
    <xsl:text>&Lesson;: </xsl:text><xsl:value-of select="title"/>
    <xsl:text>&Module;: </xsl:text><xsl:value-of select="../title"/>
    <xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>


--
G. Ken Holman                  mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.           http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0  +1(613)489-0999  (Fax:-0995)
Website: XSL/XML/DSSSL/SGML services outline,  XSL/DSSSL shareware, 
         stylesheet resource library, conference training schedule, 
         commercial stylesheet training materials, on-line XSL CBT.
Next instructor-led XSL Training: X-Tech:1999-03-07 WWW8:1999-05-11


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


Current Thread