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 August 23rd, 2006, 11:45 AM
Registered User
 
Join Date: Jun 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default removing name space (qname i think)

Hi,

this is the output that I am getting:
<div xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:k="http://example.com/v1">9 to 12</div>

But all I want is: <div>9 to 10</div>

Its probably a simple thing. I tried googeling NameSpaces and QNames and anything else that I could think of but nothing helped. Could someone point me in the right direction?
As for the xml/xslt parser version - i don't know what it is because it is embedded in a device. the vendor claims its their own but I suspect it is some common one that comes with Linux because I see that the OS they are running on the device is Red Hat.

Thanks

Here is a sample of the xml and xsl:


-----------------------

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <Response xmlns="http://example.com/v1">
            <Product>
                <Name>Crash Force R/C Regenerator - 40.68 MHz </Name>
                <AgeRange>9 to 12</AgeRange>
                <Color>Red</Color>
            </Product>
        </Response>
    </soap:Body>
</soap:Envelope>


-----------------------


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:k="http://example.com/v1">
    <xsl:output method="html"/>
    <xsl:template match="/soap:Envelope/soap:Body/k:Response/k:Product">
        <div>
            <xsl:value-of select="k:AgeRange"/>
        </div>
    </xsl:template>
</xsl:stylesheet>

---------------------




 
Old August 23rd, 2006, 11:52 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Use exclude-result-prefixes="k" on the xsl:stylesheet element.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old August 23rd, 2006, 12:00 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Use exclude-result-prefixes="soap k" on the xsl:stylesheet element.

--

Joe (Microsoft MVP - XML)
 
Old August 23rd, 2006, 01:14 PM
Registered User
 
Join Date: Jun 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

very nice. thanks.






Similar Threads
Thread Thread Starter Forum Replies Last Post
removing unwanted space below table ngvietanh HTML Code Clinic 1 August 24th, 2006 10:28 AM
xsl:output and removing space in XML ROCXY XSLT 1 March 21st, 2006 09:38 AM
resolve-Qname in XPath 2.0 by M. Kay joefawcett XSLT 1 September 26th, 2004 05:56 AM
resolve-Qname in XPath 2.0 by M. Kay joefawcett All Other Wrox Books 3 September 25th, 2004 05:05 AM





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