|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: getting xml file info
On Tue, Apr 29, 2003 at 11:16:09AM -0700,
Nathan Shaw <n8_shaw@xxxxxxxxx> wrote
a message of 34 lines which said:
> A while back, I wrote an XSLT that uses the saxon
> extension function system-id() to get the file path
> info of the xml file that I am parsing.
What does system-id() return when the XML input is not a file? For
instance, the standard input on an Unix machine? Or a DOM tree parsed
a long time ago? I believe that the difficulty to reply to this
question is one of the reasons why system-id() is not standard.
> how else could I get this information? If they do not
> exist natively in the parsers, am I looking at having
> to either write my own extension function to do this
> or pass the info in from the XML file (which kind of
> defeats the purpose)?
The way I do it, which is standard (it does not rely on extensions):
In the XSL stylesheet:
<xsl:param name="current_dir">(UNSPECIFIED)</xsl:param>
<xsl:param name="current_host">(UNSPECIFIED)</xsl:param>
...
<xsl:text>Generated on </xsl:text><xsl:value-of select="$current_host"/>
In the Makefile which calls the XSL processor:
xsltproc -o $@ \
--stringparam current_dir "`pwd`" \
--stringparam current_host "`hostname -f`" \
${STYLESHEET} $<
If you use something else than xsltproc, you just have to change the
Makefile, not the stylesheet.
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








