Bug 40564 - template-fallback needs a proper way to determine the current publication
Summary: template-fallback needs a proper way to determine the current publication
Status: NEW
Alias: None
Product: Lenya
Classification: Unclassified
Component: Miscellaneous (show other bugs)
Version: Trunk
Hardware: Other other
: P2 normal
Target Milestone: 2.0.1
Assignee: Lenya Developers
: 40674 (view as bug list)
Depends on:
Reported: 2006-09-21 07:53 UTC by edith
Modified: 2007-10-31 09:50 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description edith 2006-09-21 07:53:21 UTC
I override the tabs.xsl in a pub that uses the default pub as template.
Comment 1 Andreas Hartmann 2006-10-26 03:40:55 UTC
*** Bug 40674 has been marked as a duplicate of this bug. ***
Comment 2 Andreas Hartmann 2007-04-26 06:16:17 UTC
I can confirm this problem.
Comment 3 Andreas Hartmann 2007-04-26 06:23:04 UTC
Well, I don't think that can be fixed.

template-fallback:// doesn't look for the parent of the publication it is called
from (because it can't figure out from which location it has been called). It
just returns the second match. So if you include something with
template-fallback which in turn contains a template-fallback statement, the
latter file will try to include itself.

I'm afraid you have to address the stylesheet you want to include explicitely
(e.g., with a context:// URL).

I'm leaving this issue open, maybe we'll find a way to determine the calling
Comment 4 J 2007-04-26 06:34:13 UTC
i think this is a major issue. it will specifically bite those users who are
trying something clever and elegant with lenya. we must not frighten them :)

still, a hard problem...
Comment 5 Andreas Hartmann 2007-10-31 07:38:00 UTC
Apparently the template-fallback source factory doesn't get to resolve the URI
twice. I guess Xalan only looks at the URL and thinks that the stylesheet would
include itself ...
Comment 6 Andreas Hartmann 2007-10-31 07:58:21 UTC
Yes, this is the problem:


      if (handler.importStackContains(hrefUrl))
        throw new org.xml.sax.SAXException(

Well, I hope we'll find a way around this :(
Comment 7 Andreas Hartmann 2007-10-31 08:14:20 UTC
Jörn suggested to use a query string (e.g., ...?salt=1345243) to trick Xalan.
I'm trying this now.
Comment 8 Andreas Hartmann 2007-10-31 09:05:18 UTC
Now the leaf can resolve its parent, but then the Lenya context resolving fails.
Maybe the only solution is to change the context like the cocoon:// protocol
does ...
Comment 9 Andreas Hartmann 2007-10-31 09:50:13 UTC
The only simple way is to pass the publication ID in the URL:


I'm reducing the severity because this workaround exists.