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

Re: XPath to get value of xmlns attribute

Subject: Re: XPath to get value of xmlns attribute
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 09 Mar 2004 08:41:41 -0500
get value from xml
At 2004-03-09 08:19 -0500, Munna D wrote:
Say I have an xml document beginning as follows:
...
I want to make a list of all atttributes (including namespace declaration ones). However, both of the templates below fail to pick up the xmlns and xmlns:tt attributes:

Correct, because namespace attributes show up on the namespace axis, not on the attribute axis.


I hope the example below helps.

.................. Ken

T:\ftemp>type munna.xml
<?xml version="1.0" encoding="utf-8"?>
<!--extract for example-->
<feed version="0.2" xmlns="http://purl.org/atom/ns#"
  xmlns:tt="http://www.tt.org/ns#"/>
<!--end of extract-->

T:\ftemp>type munna.xsl
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

<xsl:output method="text"/>

<xsl:template match="*">
  <xsl:for-each select="namespace::node()">
    The prefix: <xsl:value-of select="name(.)"/>
    The URI:    <xsl:value-of select="."/>
  </xsl:for-each>
</xsl:template>

</xsl:stylesheet>
T:\ftemp>saxon munna.xml munna.xsl

    The prefix: xml
    The URI:    http://www.w3.org/XML/1998/namespace
    The prefix:
    The URI:    http://purl.org/atom/ns#
    The prefix: tt
    The URI:    http://www.tt.org/ns#
T:\ftemp>




-- US XSL training: Washington,DC March 15; San Francisco,CA March 22 World-wide on-site corporate, government & user group XML training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc


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



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.