p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XSLT (http://p2p.wrox.com/forumdisplay.php?f=86)
-   -   anyway to call a template with a lower precedence? (http://p2p.wrox.com/showthread.php?t=64185)

ojasrege November 29th, 2007 06:31 PM

anyway to call a template with a lower precedence?
 
Let's say I have a named template I name "foo". The style sheet that "foo" is in then imports a stylesheet that also has a template named "foo". Is there anyway for the importer style sheet's foo to call the lower precedence imported style sheet's foo?



bonekrusher November 29th, 2007 07:59 PM

I believe you can use a namespace to do what you are trying.



ojasrege November 29th, 2007 11:05 PM

The case I have includes three style sheets.

1) a main style sheet that generates a web page that calls template named foo() in style sheet (2)

2) this style sheet may or may not include a foo(), but this style sheet always imports style sheet (3) that always includes a foo()

3) style sheet (3) always includes foo()

This is for an application framework problem I'm working on. The idea is that external developers can optionally add a foo() to style sheet (2) that will then be directly called by style sheet (1) instead of the foo() in style sheet (3): override the name.

However, I'm thinking it would also be nice to let the developer call the original named style sheet in template (3) from the foo() in style sheet (2) if they really want to. This is sort of like apply-imports, but the developer can directly call a specific named template rather than telling the XSLT to find a matching template. Of course if there is some way to get the same thing to happen with apply-imports, I would love to know how :)



ojasrege November 30th, 2007 12:13 PM

I found one potential solution using "simulating higher order functions".




All times are GMT -4. The time now is 08:55 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.