[XML-SIG] xslt: incorporating xml with document()
Olivier CAYROL (Logilab)
Olivier.Cayrol@logilab.fr
Wed, 29 May 2002 11:49:03 +0200 (CEST)
On 05-28-2002, Jed Parsons wrote:
> <?xml version=3D"1.0"?>
> <xsl:stylesheet xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform"
> version=3D"1.0"
> xmlns=3D"http://www.w3.org/1999/xhtml">
> ...
>
> <xsl:template match=3D"section">
> <h2>
> <xsl:number level=3D'multiple' count=3D'section' format=3D'1'/>.
> <xsl:apply-templates select=3D"title" />
> </h2>
>
> <xsl:apply-templates select=3D"section|include" />
> </xsl:template>
This xsl:number instruction numbers the <section> element inside the
current document.
- For your first <section> node, you get the number 1.
- Then, with your <include> node, you use the document() function and
you are changing your current document. In this new document, your <section=
>
node is the first one so you get the number 1.
- Then, you're coming back to your first document (that is again your
current document) and in this document, the next <section> node is the
second one so you get number 2.
> What can I do to ensure that elements in the included document will be
> enuerated in the same series as elements in the original document?
The only way I see is either using a processor that implements the
xinclude behaviour (see http://www.w3.org/TR/xinclude/ ) or transforming
your xml in two steps (first one for processing <include> elements and
second one for turning the XML to HTML).
O. CAYROL.
_________________________________________________________________________
Olivier CAYROL LOGILAB - Paris (France)
http://www.logilab.com/
Change your millenium, try NARVAL the Intelligent Personal Assistant.
Changez de mill=E9naire, essayez NARVAL l'Assistant Personnel Intelligent.
_________________________________________________________________________