[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: exclude result prefixes doesn't stop prefix from s

Subject: Re: exclude result prefixes doesn't stop prefix from showingup.
From: "Mark R. Diggory" <mdiggory@xxxxxxxxxxxxxxxxx>
Date: Fri, 22 Aug 2003 13:18:36 -0400
exclude result prefixes default namespace
I'm working with Saxon 6.5.3 and Xerces 2.4. My experiences suggest that if the source document contains a default namespace then you have to map the namespace to an alternate prefix (ddi: in my example) otherwise the templates "match and select" statements do not work), in other words its impossible to match elements in the default xmlns namespace without mapping that namespace to a different prefix. I see this done often in the FAQ, see for example:


I find this counter-intuitive. It seems that if the default namespace is just a namespace with the prefix "". then if I try to match elements in that namespace, then they just shouldn't have a prefix. In other words:

<?xml version="1.0" encoding="UTF-8"?>

    <xsl:template match="codeBook">
         <xsl:apply-templates select="@*"/>
                 <xsl:value-of select="stdyDscr/citation/titlStmt/titl"/>
         <xsl:apply-templates select="*"/>


should work on the following document no matter if the xmlns is present or not:

<?xml version="1.0" encoding="utf-8"?>
<codeBook xmlns="http://www.icpsr.umich.edu/DDI" >


David Carlisle wrote:

I thought to myself, there should be some way I can match the default namespace in the source document?

there is nothing special about the default namespace just think of it as
having prefix "" with a special syntax trick that if teh prefix is ""
you don't use a colon.

Xpath is essentially blind to the prefixes used in the source, it
doesn't matter if it is <x:foo> or <b:foo> or <foo> so long as in each
case it is foo in the same namespace you always use the same Xpath to
select the element.


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.