This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Referencing the filename of an XSL file in the same file


At 03:40 PM 05/08/2000 +0100, Philip McAllister wrote:
>Is there any way I can reference the filename of a stylesheet within the
>stylesheet:
>
><?xml-stylesheet type="text/xsl"
>href="/home/httpd/html/en_GB/whelk/xsl/ticketing_venue_def.xsl"?>

Cool idea.

I don't know if this will work with Xalan, but you may be able to 
accomplish this using the document() function to refer to the stylesheet 
itself, and extract from it the xml-stylesheet PI -- using an XPath 
expression something like /processing-instruction("xml-stylesheet"). The 
catch is that href isn't a true attribute but a pseudo-attribute, so you 
will not be able to simply use the standard @href to get at its value. 
Instead, the value of a PI (per XPath spec, section 5.5) is a string which 
follows the target (the target being "xml-stylesheet" in this case) -- the 
pseudo-attributes (with their values) type and href. You could simply use 
this value or, if you must strip out the type pseudo-attribute, substring 
it for the href pseudo-attrib alone.

================================================================
John E. Simpson          | "I hate it when my foot falls asleep
http://www.flixml.org    | during the day because that means it's
simpson@polaris.net      | going to be up all night." (Steven Wright)


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]