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

CLARIFICATION ON NAMESPACE

Subject: CLARIFICATION ON NAMESPACE
From: Arul Kumar <arulxml@xxxxxxxxxxxx>
Date: Thu, 27 May 2004 08:06:51 +0530
head namespace
Hello all,

Greetings

My xml having the root element called 'root', two child elements 'head', both the head element having the namespace declaration 'fa' and 'fb' respectively, and having the child called 'title'.

In my memory, some time ago I read about the namespace declaration as 'The namespace declaration given for the current element is also valid for all children and descendants'. According to this, can I able to treat (in XSL) the 'title' element as 'fa:title' and 'fb:title'?

When I do so, in view the xml in IE, I couldn't see the expected result? Please find my XML and XSL appended below.

My XML (test.xml):

<?xml-stylesheet type="text/xsl" href="main.xsl"?>
<root>
   <head xmlns:fa="http://www.test.com/element-a">
       <title>I am in file 'fa'</title>
   </head>
   <head xmlns:fb="http://www.test.com/element-b">
       <title>I am in file 'fb'</title>
   </head>
</root>

My XSL (main.xsl):

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.test.com/xml"
xmlns:fa="http://www.test.com/element-a"
xmlns:fb="http://www.test.com/element-b">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<body>
<p style="color:red">FA: <xsl:value-of select="string(//*/*/fa:title)"/></p>
<p style="color:blue">FB: <xsl:value-of select="string(//*/*/fb:title)"/></p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


Please advice, how to achieve this? Or my understanding is wrong? Please share your valuable comments. Many thanks in advance.

Kind regards
Arul

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.