Thanks to reading Dr. Kay's most excellent _XSLT 2.0_, I found the
solution to my problem, posted earlier on this list. I said:
"I have an xml dataset that I need to display in various language
translations and views, for users who can at most open a file with a
browser (in Win and Mac Classic, usually IE but sometimes Mozilla).
This is all on a local computer, and I need to set up the user so he can
simply open a file in a browser, and get one of several xslt sheets to
provide one of several view of the same, unchanging xml data. I do not
want to ask them to edit the data file to call up a different
stylesheet, and I would much rather not ask them to shuffle various
style sheets and rename the current one to the sheet referenced in the
xml data.
That is, I need the equivalent to the simple command line function of
specifying the style sheet at run time, but using a browser. "
The answer is to have several place holder xml files which are in effect
just stylesheets themselves, for the user to click on to see different
views. Each xml file has the proper stylesheet embedded, and uses doc()
to pull in the real xml data, a database of some size.
This allows the database xml file to be read only, and allows me to set
up several stylesheets (embedded in xml with the doc() pointer) that I
(or the user if he gets to that point), can easily modify and send back
and forth.
As you all probably already know, but just for the beginners like me,
the setup is like below example (see p. 96 of _XSLT 2.0_). The key is to
point to the stylesheet using the href="#id" instead of a file name,
which in turn requires that the 'mystyleid' attribute be explicitly
declared to be type ID.
This works on my Mozilla 1.7. (thanks to the folks who offered other
suggestions, but they did not quite fit).
David Riggs, Kyoto
-------------------
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE main [<!ATTLIST xsl:stylesheet mystyleid ID #REQUIRED>]>
<?xml-stylesheet type='text/xsl' href='#s1'?>
<main>
<xsl:stylesheet mystyleid="s1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" encoding="utf-8"/>
<xsl:template match="xsl:stylesheet" /><!-- to stop processing itself as
data-->
<xsl:template match="/"> <!-- usual header html--></xsl:template>
<xsl:apply-templates select="document('onlydata.xml')/meibo/e">
<!-- the same xsl as usual-->
</xsl:apply-templates>
</xsl:stylesheet></main>
-------
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--