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

RE: How to select nodes with explicitly set default n

Subject: RE: How to select nodes with explicitly set default namespace
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 9 Mar 2005 16:56:33 -0000
xsl select node
You bind an explicit prefix to the namespace URI in the stylesheet

xmlns:p="namespace"

and use this prefix in the path expression

./p:document

Alternatively in XSLT 2.0 you can define default-xpath-namespace="namespace"
and this then applies to all unprefixed names in path expressions.

Michael Kay
http://www.saxonica.com/

 

> -----Original Message-----
> From: Olaf Meske [mailto:omeske@xxxxxxxxxxx] 
> Sent: 09 March 2005 16:34
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  How to select nodes with explicitly set 
> default namespace
> 
> Hi,
> 
> I don't know how to select a node with the default namespace if this 
> namespace is explicitly set in the xml document. If I use any 
> other name 
> for the namespace something like namespace::document would match the 
> elemet <namespace:document> .... </namespace:document>
> and if I remove the default namespace definition from the xml 
> document 
> the match="document" does also work, but if I set the default 
> namespace 
> it doesn't.
> It doesn't match eighter if I use '':document or "":document 
> or ::document
> 
> Is there any special XPath function I have to use this?
> I use Saxon 7.9.1 and XSL 2.0.
> 
> Regards,
> 
> Olaf Meske
> 
> 
> Here are the XML (minitest7.xml)
> ==============================================================
> =========
> ==============================================================
> =========
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <?xml-stylesheet type="text/xsl" href="minitest7.xsl"?>
> <document xmlns="http://www.example.com/minitest7">
> 	<content>Test text with <b>bold</b> tags.</content>
> </document>
> 
> ==============================================================
> =========
> ==============================================================
> =========
> and the XSL (minitest7.xsl)
> ==============================================================
> =========
> ==============================================================
> =========
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="2.0"
> 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> 	xmlns:xs="http://www.w3.org/2001/XMLSchema"
> 	xmlns="http://www.example.com/minitest7"
> 	>
> 
> 	<xsl:output method="xml" version="1.0" encoding="UTF-8" 
> indent="yes"/>
> 
> 	<xsl:template match="/">
> 	<root>
> 		<content><xsl:apply-templates 
> select="document"/></content>
> 	</root>
> 	
> 	</xsl:template>
> 
> 	<xsl:template match="document" >
> 		<doc x="doc content">
> 			<xsl:copy-of select="."/>
> 		</doc>
> 	</xsl:template>
> 
> </xsl:stylesheet>
> ==============================================================
> =========
> ==============================================================
> =========

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.