xsl-list
[Top] [All Lists]

Re: [xsl] something I'd really like in XSLT

2007-01-23 04:10:39
bryan rasmussen wrote:
I was just thinking but the thing that would be useful in XSLT for me
would be constructs for checking if something was already matched by
an import or include.

If you mean it such that a certain template should only be called *if* it is not previously matched by another template in some imported or included stylesheet, however deep, you can use priorities. Use a low prio in your principal stylesheet and it will only be matched *if* it does not have a match in any of the imported stylesheets. Like this:

   <xsl:template match="b" priority="-1">
       <b-matched-in-principal />
   </xsl:template>

If an imported stylesheet has a similar match, it will not match the above. The other way:

   <xsl:template match="b" priority="1">
       <b-matched-in-principal />
   </xsl:template>

will match if there is *not* the same match in any of the imported/included stylesheets.

Of course, it depends on the other set priorities.



Checks as to the level matched would also be helpful. Obviously could
implement something like this with apply-imports or nex-match if all
stylesheets in a framework could be expected to apply the method.

What do you mean with "level matched". Do you mean the order of precedence? You can calculate that (but that number is of little use in run time, I think). If I remember my lessons correctly, the precedence is calculated by means of priority, based on how specific your match is. Like "*" has less prio then "nodenamehere", which has less prio then "/nodenamehere" which has less prio then "/nodenamehere[predicatehere]".

But perhaps I misunderstood your question/request? Can you give a coded example of how you see these added features?

Cheers,
-- Abel Braaksma
  http://www.nuntia.nl

--~------------------------------------------------------------------
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>
--~--