Re: [WSG] [XSL] apply-template on multiple modes?

2005-03-03 Thread Horst Gutmann
Matthew Cruickshank wrote:
I'm pretty sure that only one template can be used at any given level.
You can match elements and in in a separate template match attributes,
but it always comes down to one template at one point. If you're trying
to cascade the results of one to the next you'd need to manually specify
it (call the second template within the first). Same goes for having
results side-by-side of the same input passed to each plugin_test*,
you'd need to manually name them.
So I guess at some point you could call all the templates and just pass
in a copy of the current node. Eg,
(I haven't tested this code, there's probably a few typos)
xsl:template match=/
   root
   xsl:call-template name=plugin_test1
  xsl:with-param name=dataxsl:copy-of//xsl:with-param
   /xsl:call-template
   xsl:call-template name=plugin_test2
  xsl:with-param name=dataxsl:copy-of//xsl:with-param
   /xsl:call-template
   /root
/xsl:template
xsl:template name=plugin_test1 priority=1
   xsl:param name=data/
   hello
/xsl:template
xsl:template name=plugin_test2 priority=2
   xsl:param name=data/
   world
/xsl:template
When you call a named template it can't even be based on a name defined
in a variable, so wildcards are certainly out.
Generally when I'm trying to match for some naming convention (like
plugin_test1 through to plugin_test) it's easier to do it in two
stages... make the result of the 1st XSLT another XSLT that names all
the plugins, and then apply that. That way the 2nd stage XSLT is static
(so far as the processor is concerned) but it adjusts.
Thank you :-)
I already feared that I haven't overlooked some feature/hack that 
permits wildcards there :-)

MfG, Horst Gutmann
**
The discussion list for  http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list  getting help
**


Re: [WSG] [XSL] apply-template on multiple modes?

2005-03-03 Thread Horst Gutmann
woric wrote:
Are you sure you want use call-template?  I have done a lot of XSLT and
have only ever used call-template when calling a specific template, so your
request sounds a little strange. Have you tried using apply-templates?
I wanted to handle it exclusively in the XSLTs without the original 
output having to be altered. So apply-templates would be no real option 
here :-)


So that you could call them for example with something like
xsl:call-template name=plugin_*/
Wilcards are definitely not permitted, and the sample you've provided will
not only not work, but  it will throw an error. (The W3C spec stipulates the
name value must be a QName, or qualified name, which restricts you to a
limited set of charcters.)
woric
Well, it wasn't meant as a sample but more as some kind of 
visualisation of what I want to achieve ;-)

MfG, Horst Gutmann
**
The discussion list for  http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list  getting help
**


Re: [WSG] [XSL] apply-template on multiple modes?

2005-03-02 Thread Matthew Cruickshank
Horst Gutmann wrote:
Hi :-)
I just read the part of the XSL specification about modi on templates 
but I have a probably quite stupid question: Is it somehow possible to 
call-template ALL templates, no matter what mode they have set?
I'm pretty sure that only one template can be used at any given level.
You can match elements and in in a separate template match attributes,
but it always comes down to one template at one point. If you're trying
to cascade the results of one to the next you'd need to manually specify
it (call the second template within the first). Same goes for having
results side-by-side of the same input passed to each plugin_test*,
you'd need to manually name them.
So I guess at some point you could call all the templates and just pass
in a copy of the current node. Eg,
(I haven't tested this code, there's probably a few typos)
xsl:template match=/
   root
   xsl:call-template name=plugin_test1
  xsl:with-param name=dataxsl:copy-of//xsl:with-param
   /xsl:call-template
   xsl:call-template name=plugin_test2
  xsl:with-param name=dataxsl:copy-of//xsl:with-param
   /xsl:call-template
   /root
/xsl:template
xsl:template name=plugin_test1 priority=1
   xsl:param name=data/
   hello
/xsl:template
xsl:template name=plugin_test2 priority=2
   xsl:param name=data/
   world
/xsl:template
When you call a named template it can't even be based on a name defined
in a variable, so wildcards are certainly out.
Generally when I'm trying to match for some naming convention (like
plugin_test1 through to plugin_test) it's easier to do it in two
stages... make the result of the 1st XSLT another XSLT that names all
the plugins, and then apply that. That way the 2nd stage XSLT is static
(so far as the processor is concerned) but it adjusts.

.Matthew Cruickshank
http://holloway.co.nz/phpilfer  xslt php framework that's looking for
developers
**
The discussion list for  http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list  getting help
**


Re: [WSG] [XSL] apply-template on multiple modes?

2005-03-02 Thread woric
 Is it somehow possible to call-template ALL templates, no matter what mode
they have set?

Are you sure you want use call-template?  I have done a lot of XSLT and
have only ever used call-template when calling a specific template, so your
request sounds a little strange. Have you tried using apply-templates?

 So that you could call them for example with something like
xsl:call-template name=plugin_*/

Wilcards are definitely not permitted, and the sample you've provided will
not only not work, but  it will throw an error. (The W3C spec stipulates the
name value must be a QName, or qualified name, which restricts you to a
limited set of charcters.)

woric




**
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list  getting help
**