RE: [xsl] Is there a neat way to get style-sheet relative paths?

Subject: RE: [xsl] Is there a neat way to get style-sheet relative paths?
From: "chris bayes" <chris@xxxxxxxxxxx>
Date: Tue, 20 Jul 2004 09:14:11 +0100
One of my thumbtack methods.

(combinations of xsl:include and <!ENTITY can be confusing. Programmer
emptor ')

<?xml version='1.0'?>

<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
      xmlns:cjb="http://www.bayes.co.uk/XSL/wtfaw";>
<xsl:output method="html"/>

<xsl:include href=              "WTFAW.XSL"/>
<!-- we can also not be here :-D
<xsl:include href="somewhere../..else.followedbyamoonlightshadow.xsl" /> etc
-->

<xsl:template match="/">
 <html><body>
  <h3>The value of cjb:WTFAW (Where the f*** are we) is </h3><xsl:value-of
select="$cjb:WTFAW"/>
         <h3>The value of cjb:WTFWAN (Where the f*** we are not) is
</h3><xsl:value-of select="$cjb:WTFWAN"/>
         <h3>The value of cjb:WTFAOSR (Where the f*** are our site
relatives) is </h3><xsl:value-of select="$cjb:WTFAOSR"/> <b>(a useless
variable)</b>
         <h3>The value of cjb:YHSMOK (You haven't seen me OK?) is
</h3><xsl:value-of select="$cjb:YHSMOK"/> :-D
  			<img src="{$cjb:YHSMOK}/jpg.jpg" />
 </body></html>
</xsl:template>
</xsl:stylesheet>








--------(self contained)------------WTFAW.XSL

<?xml version='1.0'?>
<!DOCTYPE xsl:stylesheet [
<!ELEMENT xsl:stylesheet ANY>
<!ATTLIST xsl:stylesheet version CDATA #IMPLIED>
<!ATTLIST xsl:stylesheet xmlns:xsl CDATA #IMPLIED>
<!ATTLIST xsl:stylesheet xmlns:cjb CDATA #IMPLIED>
<!ELEMENT xsl:variable ANY>
<!ATTLIST xsl:variable name CDATA #IMPLIED>
<!ELEMENT xsl:for-each ANY>
<!ATTLIST xsl:for-each select CDATA #IMPLIED>
<!ELEMENT xsl:value-of ANY>
<!ATTLIST xsl:value-of select CDATA #IMPLIED>


<!NOTATION XSL SYSTEM "urn:bayes.co.uk">
<!ENTITY xsl SYSTEM "WhereTheFuckAreWe.xsl" NDATA XSL>


<!ENTITY xslWANH SYSTEM
"someplace/anotherplace/somewhereDeepInTheWebThatChangesEveryDay/butOnlyThis
DocumentNeedsToChange/WeAreNotHere.xsl" NDATA XSL>


<!ENTITY xslOSR SYSTEM "/OurSiteRelatives.xsl" NDATA XSL>
<!ENTITY xslODR SYSTEM "OurDocumentRelatives.xsl" NDATA XSL>
]>
<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
      xmlns:cjb="http://www.bayes.co.uk/XSL/wtfaw";>
<xsl:variable name="cjb:WTFAW">
  <xsl:for-each select="document('')">
 	<xsl:value-of select="substring-before(unparsed-entity-uri('xsl'),
'WhereTheFuckAreWe.xsl')" />
  </xsl:for-each>
</xsl:variable>
<xsl:variable name="cjb:WTFWAN">
  <xsl:for-each select="document('')">
 	<xsl:value-of
select="substring-before(unparsed-entity-uri('xslWANH'),
'WeAreNotHere.xsl')" />
  </xsl:for-each>
</xsl:variable>
<xsl:variable name="cjb:WTFAOSR">
  <xsl:for-each select="document('')">
 	<xsl:value-of
select="substring-before(unparsed-entity-uri('xslOSR'),
'OurSiteRelatives.xsl')" />
  </xsl:for-each>
</xsl:variable>
<xsl:variable name="cjb:YHSMOK">
  <xsl:for-each select="document('')">
 	<xsl:value-of
select="substring-before(unparsed-entity-uri('xslNSM'), 'NotSeenMe.xsl')" />
  </xsl:for-each>
</xsl:variable>
</xsl:stylesheet>

Current Thread