xsl-list
[Top] [All Lists]

Re: new user question Saxon

2005-09-22 05:16:43

so if the named template isn't called (incidentally why do you have all
those named templates, it makes the code a lot harder to follow than
need be, I expect)

then this isn't being executed.

         <xsl:template match="ARTICLE">

Which presumably means that you do not have an element of that name in
the source.

A common mistake here is for people to forget that the namespace is part
of the name, the above matches an element with namespace URI ""  and
local name ARTICLE and it doesn't match an element
<ARTICLE xmlns="foo"> just as it doesn't match an element <XXARTICLE>

To match <ARTICLE xmlns="foo">  you'd need to either do

<xsl:template match="f:ARTICLE" xmlns:f="foo">

(The xslt1 way)

or set the default xpath namespace to foo with

xpath-default-namespace="foo" on your xsl:stylesheet.


Note that // is an expensive operation, it means search the entire
document to arbitrary depth.
If you know you only have one BODY element and it's somewhere near the
top of the document, don't do this:

                 <xsl:variable name="body" select="//BODY"/>
as the system doesn't know that...


David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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



<Prev in Thread] Current Thread [Next in Thread>