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 22:29:15 GMT
Yeah, but how do I use the count function in this case?
I try <xsl:number count="menuhead" />, but that's not working.  It comes up
blank, even though there are menuheads in the element I'm in.  The only time
it's working for me, is to return the id of the particular menuhead I'm on
when I'm in an xsl:for-each loop.
So, how can I make this work:
<xsl:template match="menu">
   <xsl:number count="menuitem" />
I'm thinking this should echo the number of menuitems in menu.  But it's not
doing anything.

-----Original Message-----
From: Jeffrey_M_Grossman@Countrywide.Com
Sent: Tuesday, September 12, 2000 4:56 PM
Subject: RE: including xml into xsl

I believe that you are correct, that the count XPATH function is the best
way. I am assuming that you are talking about a horizontal menu. For a
vertical menu I am not quite sure why you would need to have the count.

Jeffery Grossman
Countrywide Home Loans

                    Smith"               To:
                    <msmith@winde        cc:
          >              Subject:     RE: including xml into

                    01:44 PM
                    respond to

     Thanks guys.
     Now, I'll ask another question since it looks like you've already used
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
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
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
> 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:

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

View raw message