[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Parameters in the XPath for 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.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|