XSLT-Problem: How to copy nodes from template to variable and calling this variable to getting nodes
"Sticker, Markus / Kuehne + Nagel / Ham MI-EC /external" <[email protected]> Wed, 6 Oct 2010 15:40:33 +0200
| Newsgroups | gmane.text.xml.xalan.java.user |
|---|---|
| Message-ID | <8BE1FACDAC82D647B750825BCA346AE20262ACA8@w3hamboex11.ger.win.int.kn> |
Hello,
I have a problem to fill a variable with nodes from a template.
After that I want to call this variable to place this nodes.
But what I get is a long String.
Thanks for your help
best regards
Markus
XSLT-File
----------
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://somewhere.com/v_1_6/outgen" xmlns:kn="knExt" xmlns:saxon="http://saxon.sf.net/" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xalan="http://xml.apache.org/xalan" extension-element-prefixes="kn saxon" xmlns:exslt="http://exslt.org/common" exclude-result-prefixes="xalan a exslt fn saxon">
<xsl:output method="xml"/>
<xsl:template match="/">
<!-- this works fine - start -->
<xsl:variable name="def" as="node()*">
<bo>
<item>1</item>
<boline>4</boline>
<totals>6</totals>
</bo>
</xsl:variable>
<xsl:value-of select="{exslt:node-set($def)/bo/item}"/>
<!-- this works fine - end -->
<!-- this is the part - start -->
<xsl:variable name="headlines" as="node()*">
<xsl:call-template name="headlines"/>
</xsl:variable>
<xsl:value-of select="exslt:node-set($headlines)" />
</xsl:template>
<xsl:template name="headlines" as="item()*">
<field name="L_head">
<xsl:value-of select="a:doc/a:Headlines"/>
</field>
</xsl:template>
<!-- this is the part - end -->
</xsl:stylesheet>
XML-file
-----------
<?xml version="1.0" encoding="UTF-8"?>
<doc xmlns="http://somewhere.com/v_1_6/outgen">
<Headlines id="23467201">Dog bites man</Headlines>
<Headlines id="23423441">Man bites dog</Headlines>
</doc>
Kuehne + Nagel (AG & Co.) KG, Geschaeftsleitung: Hans-Georg Brinkmann (Vors.), Dirk Blesius, Reiner Heiken, Bruno Mang, Alfred Manke, Christian Marnetté, Mark Reinhardt, Jens Wollesen, Klaus Jaeger (stellv.), Sitz: Bremen, Registergericht: Bremen, HRA 21928, USt-IdNr.: DE 812773878, Persoenlich haftende Gesellschaft: Kuehne & Nagel A.G., Sitz: Contern/Luxemburg Geschaeftsfuehrender Verwaltungsrat: Klaus-Michael Kuehne