xsl-list
[Top] [All Lists]

RE: [xsl] Passing parameters using <xsl:apply-templates>

2008-02-16 12:31:37
You haven't really shown what you're doing in enough detail for me to see
what you're doing wrong. In particular, I don't see any xsl:apply-templates
and I don't see any parameters. But why don't you try:

<xsl:for-each select="//@filename">
  <xsl:variable name="filename" select="."/>
  <xsl:variable name="doc" select="document($filename)"/>
   ...

</xsl:for-each> 

-----Original Message-----
From: Mark [mailto:charltonrainbird(_at_)googlemail(_dot_)com] 
Sent: 16 February 2008 19:11
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Passing parameters using <xsl:apply-templates>

I'm still bashing my head against this problem. Maybe I'm 
making this more complicated than necessary and don't need to 
use parameters, which I still can't get to work. I think this 
is because I have to use <xsl:apply-templates to set the 
value of my parameter and I can't get this to work when I 
need to use the document function. I'm not sure whether this 
is fundamentally wrong or just because I can't get it to work.

Essentially, I'm processing an xml file which is a list of 
xml files using the document function:

<xsl:for-each select="document(//@filename)">

 .. processing instructions to use <xsl:for-each> and 
<xsl:result-document> along with <xsl:apply-templates> to 
produce split output files from each of the xml files listed 
in that initial file

What I need is the document-uri(.) (which was what I was trying to do
originally) or, alternatively, as Eliot suggested, the value 
of @filename to use as the prefix for my output file names.

Problem is that I just keep ending up with the value of the 
input file name, not the value of the nodes attribute 
@filename that it processes. Alternatively, I end up with nothing.

Any further pointers?

Thanks for your patience.

Mark


On Sat, Feb 16, 2008 at 2:16 PM, Michael Kay 
<mike(_at_)saxonica(_dot_)com> wrote:
Another tip: a very easy-to-make and hard-to-diagnose mistake
 > is forgetting to specify tunnel="yes" on the param statements

 You can reduce the risk by getting into the habit of specifying  
required="yes" on all parameters unless you really want 
them to be optional.

 Michael Kay
 http://www.saxonica.com/




 
--~------------------------------------------------------------------
 XSL-List info and archive:  
http://www.mulberrytech.com/xsl/xsl-list
 To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
 or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
 --~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--