This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
changing the nodeset
- To: "XSL-Liste (E-Mail)" <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] changing the nodeset
- From: Michael Schäfer <MSchaefer at PFEILGMBH dot DE>
- Date: Thu, 12 Jul 2001 17:00:04 +0200
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hello,
I process a XML-doc, which contains several <EL1>-elements and
<EL2>-elements and so on. The processing adds numbers as elements to the
new tree.
Now I want to start with numbers, I load from another xml-file, let's
say calld start.xml
In the root of the target I want to add a entity, which contains
elements for all counted elements with the occurrences + the start
values.
So I try
<xsl:template match="/ROOT">
<!-- now I am in the root-node -->
<xsl:copy>
<!-- I copy the root-node and all them children -->
<xsl:apply-templates select="node()|@*" />
<!-- now I create a new entity -->
<xsl:element name="START">
<!-- I process the nodes in document start.xml
-->
<xsl:for-each
select="document('start.xml')/START/*">
<!-- Now my context is a child of
start.xml/START -->
<!-- I add a new element with the name
of the current node -->
<xsl:element name="{name()}">
<!-- and now I want to add the
content of context-node with the occurences of th original doc -->
<!-- so I have to change context
but how ? -->
<xsl:value-of
select="number(.)+count(//name())/">
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:copy>
</xsl:template>
Mit freundlichen Grüßen
Michael Schäfer
---------------------------------------------------------------
Dipl.-Ing. Michael Schäfer
e-business
Pfeil GmbH
Obertorstr. 4-6
66111 Saarbrücken
Tel.: 06 81/3 79 85-30
Fax: 06 81/3 79 85-13
e-Mail: mschaefer@pfeilgmbh.de
Internet: www.pfeilgmbh.de
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list