[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: getting xml file info

Subject: Re: getting xml file info
From: Stephane Bortzmeyer <bortzmeyer@xxxxxx>
Date: Wed, 30 Apr 2003 12:48:32 +0200
xml file path
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.