|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: entities in XML/XSL
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








