Hi List,
(sorry for resending because of an incorrect subject line!)
I have some input documents (from xslt 1.0, xforms), which I want to
assemble into one single document by using the xsl:collection
function. But I seem not to be able to get rid of some namespace
declarations!
Input (many of them):
<?xml version="1.0" encoding="UTF-8"?>
<openimmo xmlns="http://www.openimmo.de"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:im="http://www.openimmo.de"
xmlns:ic="http://www.example.com">
<ic:auftraggeber>
<ic:name/>
</ic:auftraggeber>
<anbieter>
<immobilie>
<objektkategorie>
<ic:objektart>wohnung</ic:objektart>
</objektkategorie>
</immobilie>
</anbieter>
</openimmo>
XSLT:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0"
xpath-default-namespace="http://www.openimmo.de"
xmlns="http://www.openimmo.de"
xmlns:im="http://www.openimmo.de"
xmlns:ic="http://www.example.com"
xmlns:xf="http://www.w3.org/2002/xforms"
exclude-result-prefixes="im xf"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>
<xsl:template name="init">
<xsl:result-document href="../ns-test/test_2009_06_11.xml">
<openimmo xmlns="http://www.openimmo.de"
xmlns:ic="http://www.example.com">
<xsl:apply-templates
select="collection('../ns-test?select=fertig*.xml')"/>
</openimmo>
</xsl:result-document>
</xsl:template>
<xsl:template match="openimmo|anbieter">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="openimmo/ic:auftraggeber"/>
<xsl:template match="immobilie[not(ic:auftraggeber)]">
<xsl:copy>
<xsl:copy-of select="/openimmo/ic:auftraggeber"/>
<xsl:apply-templates select="*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="objektkategorie/ic:objektart">
<objektart>
<xsl:element name="{.}" namespace="http://www.openimmo.de"/>
</objektart>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Output (using Saxon 9.1.0.5J )
<?xml version="1.0" encoding="UTF-8"?>
<openimmo xmlns="http://www.openimmo.de"
xmlns:ic="http://www.example.com">
<immobilie xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:im="http://www.openimmo.de">
<ic:auftraggeber>
<ic:name/>
</ic:auftraggeber>
<objektkategorie>
<objektart>
<wohnung/>
</objektart>
</objektkategorie>
</immobilie>
</openimmo>
What I would like to see:
<openimmo xmlns="http://www.openimmo.de"
xmlns:ic="http://www.example.com">
<immobilie>
...
I'm sure this can be achieved, but have been running out of ideas.
Manfred
--~------------------------------------------------------------------
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>
--~--