You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Matthew Smith <ms...@windebt.com> on 2000/09/12 20:55:27 UTC

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 xsl
to add a file as if it was a part of the original xml document called.  I've
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


RE: including xml into xsl

Posted by Matthew Smith <ms...@windebt.com>.
	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 :
<menu>
   <menuhead link="home.xml" name="Home">
      <menuitem link="home.xml" name="Go Home!" />
      <menuitem link="map.xml" name="Sitemap" />
   </menuhead>
   <menuhead link="company.xml" name="Company">
      <menuitem link="aboutus.xml" name="About Us" />
      <menuitem link="employment.xml" name="Employment" />
   </menuhead>
</menu>

	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">?

Thanks,
Matt


-----Original Message-----
From: OD [mailto:od@feersumendjinns.com]
Sent: Tuesday, September 12, 2000 2:57 PM
To: cocoon-users@xml.apache.org
Subject: Re: including xml into xsl


Hi,

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.

and

<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 <ms...@windebt.com>
To: Cocoon List (E-mail) <co...@xml.apache.org>
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
xsl
> to add a file as if it was a part of the original xml document called.
I've
> 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: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org



Re: including xml into xsl

Posted by OD <od...@feersumendjinns.com>.
Hi,

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.

and

<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 <ms...@windebt.com>
To: Cocoon List (E-mail) <co...@xml.apache.org>
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
xsl
> to add a file as if it was a part of the original xml document called.
I've
> 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: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org