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

Re: Using document() and XPath to extract data from mu

Subject: Re: Using document() and XPath to extract data from multiple namespac es in multiple files
From: Armen Martirossian <armmarti@xxxxxxxxx>
Date: Thu, 14 Aug 2003 00:27:36 -0700 (PDT)
extract data from xhtml
--- "SORENS,MICHAEL (HP-Boise,ex1)"
<michael.sorens@xxxxxx> wrote:
> I am attempting to use xsltproc to process try.xml
> with test.xsl. The files
> history.xml and motivation.xml are read by test.xsl.
> The issue is this:
> while I am able to extract data with explicit
> namespaces (cc:title and
> cc:version in this case), when I attempt to extract
> data from the unadorned
> "foo" element or an attribute of the unadorned
> "meta" element, I get
> nothing. Any thoughts appreciated...
> 
The elements "foo" and "meta" are in the default
namespace, i.e. in the "http://www.w3.org/1999/xhtml".
Therefore, you have to declare a namespace having that
URI in the test.xsl, say, like this:

...
<xsl:template match="/files">
	<cc:myDoc
		xmlns:cc="stuff.com"
		xmlns="http://www.w3.org/1999/xhtml"
	
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
			>
	<cc:indexList>

....

and then change the XPath expressions to extract the
values correctly:

...
  <display-title><xsl:value-of
select="$extNode/cc:head/xhtml:foo"/></display-title>
  <keywords><xsl:value-of
select="$extNode/cc:head/xhtml:meta[@name='keywords']/@content"/>
...

Regards,
Armen

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

 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.