Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 17th, 2007, 05:04 AM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default namespace problem

My xml structure is like that

<?xml version="1.0" encoding="UTF-8" ?>
- <Module version="90020900" xmlns="http://xmlns.oracle.com/Forms">

for that namespace URI my xpath is not working mens in xslt i'm giving one xpression to get some node value ....but in xml if
xmlns="http://xmlns.oracle.com/Forms" is there it is not working..if i delete that xslt woking fine....how to handle this case in xslt...pls give me the syntax..i'm new to it
thnx
 
Old February 17th, 2007, 01:32 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Please google for "XSLT FAQ default namespace".

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old February 18th, 2007, 02:17 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i'm very new to it..if any default namespace is specified my xpath is not working..pls help me with the syntax how i have to handle it..i have searched in the net but did't understand how to avoid this...
 
Old February 18th, 2007, 05:19 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

To select the Module element in your source document you need

<xsl:stylesheet xmlns:m="http://xmlns.oracle.com/Forms">

...

   <xsl:template match="m:Module">
     ...

and similarly for any other element in this namespace. An unprefixed name in a match pattern or XPath expression always refers to an element that is in no namespace; to refer to an element in a namespace, whether or not it is the default namespace, you need an explicit prefix.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old February 19th, 2007, 12:16 AM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://xmlns.oracle.com/Forms">

<xsl:template match="m:Module">
<div id="treeNode{position()}" style=""><table border="0" cellspacing="0" cellpadding="0"><tr><td valign="middle" onclick="whenNodeSelected(this)">
<xsl:value-of select="m:FormModule/m:@Name"/></td></tr></table>

suppose this is my xsl....then how to do that..is the sytax is correct???
 
Old February 19th, 2007, 12:51 AM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thnx.....got it..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Namespace problem Harshal123 BOOK: Beginning XML, 4th Ed ISBN: 978-0-470-11487-2 1 October 21st, 2008 06:35 AM
namespace problem muki XSLT 1 November 13th, 2005 12:25 PM
Namespace Problem JRMotz BOOK: ASP.NET Website Programming Problem-Design-Solution 1 November 12th, 2005 03:18 PM
namespace problem marclena XSLT 1 February 12th, 2004 03:48 PM
Problem with Namespace allenracho BOOK: ASP.NET Website Programming Problem-Design-Solution 2 October 22nd, 2003 11:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.