[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] How to get rid of some namespace declarations
Hi List, 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|