|
Subject: Re: [xsl] Getting the path to the stylesheet [RETRY] From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 05 Jul 2012 21:51:40 -0400 |
On Thu, Jul 5, 2012 at 3:06 PM, Michael Kay <mike@xxxxxxxxxxxx> wrote: > > On 05/07/2012 15:00, Ihe Onwuka wrote: >> >> What is the standard way of getting the absolute path to a stylesheet >> so that references in the result tree can be resolved relative to it. >> >> > > Call the static-base-uri() function. >
Sorry for not clarifyingl, does that work for XSLT 1.0, if not what does.
~/t/ftemp $ pwd /Users/admin/t/ftemp ~/t/ftemp $ xslt ihe.xml ihe.xsl
~/t/ftemp $ cat ihe.xsl <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:stylesheet [ <!NOTATION xsl SYSTEM ""> <!ENTITY static-base-uri SYSTEM "" NDATA xsl> ]> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<xsl:variable name="static-base-uri">
<xsl:for-each select="document('')">
<xsl:value-of select="unparsed-entity-uri('static-base-uri')"/>
</xsl:for-each>
</xsl:variable>
Stylesheet URI: <xsl:value-of select="$static-base-uri"/>
<xsl:text>

</xsl:text>
</xsl:template></xsl:stylesheet> ~/t/ftemp $ cat ihe.xml <?xml version="1.0" encoding="UTF-8"?> <doc/> ~/t/ftemp $
-- Public XSLT, XSL-FO, UBL and code list classes in Europe -- Oct 2012 Contact us for world-wide XML consulting and instructor-led training Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Handling a missing namesp, Martin Honnen | Thread | Re: [xsl] Getting the path to the s, Ihe Onwuka |
| Re: [xsl] Getting the path to the s, G. Ken Holman | Date | Re: [xsl] Getting the path to the s, Ihe Onwuka |
| Month |