cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Smith" <>
Subject RE: including xml into xsl
Date Tue, 12 Sep 2000 20:44:58 GMT
	Thanks guys.
	Now, I'll ask another question since it looks like you've already used this
in the same manner I'm attempting to - for a menu.
	I don't know how to count the number of menuheads or menuitems when I'm not
in a loop for those particular elements.  I've got my xml menu, something
like this :
   <menuhead link="home.xml" name="Home">
      <menuitem link="home.xml" name="Go Home!" />
      <menuitem link="map.xml" name="Sitemap" />
   <menuhead link="company.xml" name="Company">
      <menuitem link="aboutus.xml" name="About Us" />
      <menuitem link="employment.xml" name="Employment" />

	When I'm working in <xsl:for-each> loops I can build id's for each menuhead
or menuitem by using <xsl:number count="menuhead"> (is this the best way to
do this?), or with the count being "menuitem" as applicable.  So I can use
this to build my html without any problem.  My problem comes in writing my
javascript.  At the bottom of the menu's html I need a line of javascript to
define a variable with the number of menuheads, and eventualy may have to
contain more information about submenus.
	So, how can I find the number of menuheads in menu when I'm working in
<xsl:template match="menu">?


-----Original Message-----
From: OD []
Sent: Tuesday, September 12, 2000 2:57 PM
Subject: Re: including xml into xsl


I believe theres a couple of ways to achieve this... See the Document()
function in the XSLT specs

This way works for me:

<xsl:apply-templates select="document('menu.xml')"/>

Will load the file menu.xml as a result tree/node set.


<xsl:apply-templates select="document('menu.xml')//subgroup"/>

Will load all the <subgroup> elements from menu.xml.

Corey O'Donovan

----- Original Message -----
From: Matthew Smith <>
To: Cocoon List (E-mail) <>
Sent: Tuesday, September 12, 2000 7:55 PM
Subject: including xml into xsl

> I want to include a bit of xml from a file using my xsl stylesheet, and
> then parse it with the style sheet.  Basicly, I want to use a command in
> to add a file as if it was a part of the original xml document called.
> searched high and low for the command to do this, but have yet to find it.
> I can't imagine it's rarely used feature.
> Danke,
> Matt
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message