Re: [xsl] Specifying xml source in xsl stylesheet

Subject: Re: [xsl] Specifying xml source in xsl stylesheet
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Fri, 25 Apr 2003 01:26:15 +0200
Gregory Propf wrote:
Is there any way to hard-code the xml file to be parsed by a particular xsl stylesheet? I want to associate a menu.xml file with a menu.xsl stylesheet and then be able to include the menu.xsl in another xsl file. The idea is to have the same menu always available for multiple files.

You can try the trick which reads XML data from the style sheet:
<xsl:stylesheet ...
  xmlns:menu="http://whatever.urk/templates/menu";>
 <menu:data>
   <!-- your menu XML here -->
 </menu:data>

 <xsl:variable name="menudata"
  select="document('')/xsl:stylesheet/menu:data"/>

You can use $menudata to refer to your menu XML data, for example
  <xsl:apply-templates select="$menudata/menu/menuitem"/>

J.Pietschmann


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



Current Thread