Re: [xsl] Get Stylesheet name

Subject: Re: [xsl] Get Stylesheet name
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 13 Mar 2003 15:55:19 +0000
Hi Ankit,

> I know this is a way off the topic but could somebody please tell me
> how to extract the name of a stylesheet from the xml document.
>
> My problem is to get the stylesheet applied to an xml doc and then
> import the same stylesheet in a new stylesheet to apply to another
> document.

I assume that your XML document includes a <?xml-stylesheet?>
processing instruction that points to the stylesheet that you want to
get the name of?

If so, you can locate that PI using:

  <xsl:variable name="PI"
    select="/processing-instruction('xml-stylesheet')" />

and then get the stylesheet name by string processing the value of the
PI. Assuming the PI uses double quotes around the href
pseudo-attribute value, for example, you can use:

  <xsl:value-of
    select="substring-before(substring-after($PI, 'href=&quot;'),
                             '&quot;')" />

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread