Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 21st, 2004, 12:39 AM
Registered User
 
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default identity transformation insist on outputting xmlns


Hi:

this question has been driving me crazy. would be grateful for any help.


I am writing a version of the identity transformation to filter some
documents (they happen to be wsdl docs).
My problem is that for just about every element in the
output document all of the namespace defintions defined in my top level
element are emitted.

This makes for a very cluttered document. I'm wondering how i can
surpress of the emission of these xmlns attributes from the output tree.


here is a simple example:


INPUT XML DOC:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:uang-bpws="http://www.siebel.com/uangrammar/2002/03/bpel4ws/" name="tfXWidgetSrc_WSDL" targetNamespace="http://www.o.com/">

  <wsdl:import pig="dog"/>
  <book xmlns:blah="urn:foo"/>
</wsdl:definitions>


XSLT DOC:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" >
    <xsl:template match="node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="@*[ not ( starts-with(name(),'xmlns:') ) ]">
        <xsl:copy-of select="."/>
    </xsl:template>

    <xsl:template match="wsdl:definitions">
        <wsdl:BLAH>
            <xsl:apply-templates select="@*|node()"/>
        </wsdl:BLAH>
    </xsl:template>

</xsl:stylesheet


RESULT:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:BLAH xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="tfXWidgetSrc_WSDL" targetNamespace="http://www.o.com/">

  <wsdl:import xmlns:uang-bpws="http://www.siebel.com/uangrammar/2002/03/bpel4ws/" pig="dog"/>
  <book xmlns:uang-bpws="http://www.siebel.com/uangrammar/2002/03/bpel4ws/" xmlns:blah="urn:foo"/>
</wsdl:BLAH>


Observations:

the output tree includes xmlns: attributes in both the wsdl:import tag and the book tag.... even though they were not
defined in the input doc to begin with.

I tried to surpress the xmlns: attributes with
    @*[ not ( starts-with(name(),'xmlns:') ) ]
but that works the same as vanilla
    @*


any advice much appreciated.
    -chris ( _clb_ )

 
Old May 21st, 2004, 11:29 AM
Registered User
 
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I got a very helpful reply from Ben Edgington:

  summary: this seems to be a result of a xalan bug. xsltproc
  does not seem to give these whacky results.

full text of reply:
http://groups.google.com/groups?dq=&...Dcomp.text.xml







Similar Threads
Thread Thread Starter Forum Replies Last Post
Not outputting a specific node zach_1988 XSLT 3 December 2nd, 2008 10:49 AM
Transformation not working with a specific xmlns sunrain XSLT 3 October 30th, 2008 12:14 PM
outputting to multiple documents? wilgartw XSLT 3 November 7th, 2007 07:52 PM
Outputting Array manih C++ Programming 2 June 14th, 2006 08:24 PM
Outputting an end of line y_simonson XSLT 1 February 5th, 2004 05:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.