[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Parameters in the XPath for apply templates.

Subject: RE: Parameters in the XPath for apply templates.
From: "Christopher Hearns" <chearns@xxxxxxxxxx>
Date: Fri, 7 May 2004 11:18:39 -0400
xpath apply templates
select="document($doc)//*[local-name() = $type]"

christopher hearns, Esq.
let me touch your perfect body with my mind
http://www.countplusplus.ca 

-----Original Message-----
From: bjchamb@xxxxxxxxxxxxx [mailto:bjchamb@xxxxxxxxxxxxx]


First, the problem I'm having. I have the following template:

<xsl:template name="process">
<xsl:param name="type"/>
<xsl:param name="doc"/>
<xsl:apply-templates select="document($doc)//$type"/>
</xsl:template>

The problem is that the $type isn't allowed here. I have confirmed that if I
do select="document($doc)//itemA" it works.

I'll explain more about what I'm doing in hopes that it will help.

My xml file is something like this:
<file src="a"/>
<file src="b"/>
...
<file src="z"/>

Each of these, correspond to xml files that I want to process. The structure
of these have several different things that I'm trying to draw out, for
example, if a.xml contained the following:

<contents>
<para>
<itemA name="blah"/>
<itemA name="what"/>
<itemB name="foo"/>
</para>
</contents>

And I want to generate output similar to the following:

<H1>A</H1>
blah
what
<H1>B</H1>
fooI want to go over all the files in the index.xml (the one that the xslt
is called on) and for all the files in create a grouped list of all items of A
and all items of B. In order to handle the grouping I'm planning on adapting
the algorithm for grouping that I found on Jeni's page, but first I need to get
through this problem of processing the documents. What I currently do is
iterate over all files and call this function with type equal to itemA and doc
equal to the appropriate file name. After processing all files using this, i
then call this template with type equal to itemB and doc equal to the
appropriate file name again. I know it is innefficient to process the files
twice, but I can't really think of any other way of processing this without
using multiple levels of grouping or something like that, and I'm really not up
to the task of figuring out how to do that...

All I really need is help getting the $type working, but any help that can be
offered will be greatly appreciated.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.