473,946 Members | 29,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML & XSLT namespaces

I've got a bit of a problem, and I'm stumped.

I'm working on a system to create web pages based on XML files. I'd like
to be able to use a variety of techniques to make the coding faster & more
maintainable.

To that end, I have some XML and XSLT files that I use as 'subroutines' to
build the pages faster. All pretty standard stuff.

My problem is this: I have two xml/xslt file pairs that I'm using, and
they both use their own namespace. One works, and one doesn't and I can't
tell why the one doesn't work.
-----------------------
index.xml:
<?xml version="1.0"?>
<!DOCTYPE page[
<!ENTITY navtree SYSTEM "nav.xml">
]>
<page xmlns:xform="ht tp://cfconsulting.ca/xmlform/1.0">
<title>Page Title</title>
<navtree>&navtr ee;</navtree>
<body>
<sect>
<title>Form Test</title>
<p>Form follows this:</p>
<xform:form>
<xform:textwidg et name='test_text ' value='a test value'/>
<xform:buttonwi dget name='test_but' value='Submit'/>
</xform:form>
</sect>
</body>
</page>
-----------------
xform.xsl:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:xform="ht tp://cfconsulting.ca/xform/1.0">

<xsl:template match="xform:fo rm">
<form>
<xsl:apply-templates />
</form>
</xsl:template>

<xsl:template match="xform:te xtwidget">
<input type="text" name="{@name}" value="{@value} " />
</xsl:template>

<xsl:template match="xform:bu ttonwidget">
<input type="button" name="{@name}" value="{@value} " />
</xsl:template>

</xsl:stylesheet>

The nav.xml file defines & uses a namespace (nav:), which is referenced in
the nav.xsl file. That works fine. I get my navigation tree.

The xform (yes, I know about XFORMS, this is just a convenient name for
now) namespace, however, is for some reason ignored. When I use xsltproc
with -v, I can see it parse the xform namespace, but when it gets to
parsing this file, it says that there is no handler for 'textwidget' and
'buttonwidget'.

If I take the xform namespace right out, of both the index.xml and the
xform.xsl file, the form works. If the namespace is in use, the form isn't
there.

I'm sure I'm doing something stupid in regards to using or defining the
xform namespace, but I can't figure out what it is, and the xsltproc
debugging dump isn't any help (at least in this case).

Suggestions?

cf
Jul 20 '05 #1
2 2034


Colin Fox wrote:

I'm working on a system to create web pages based on XML files. I'd like
to be able to use a variety of techniques to make the coding faster & more
maintainable.

To that end, I have some XML and XSLT files that I use as 'subroutines' to
build the pages faster. All pretty standard stuff.

My problem is this: I have two xml/xslt file pairs that I'm using, and
they both use their own namespace. One works, and one doesn't and I can't
tell why the one doesn't work.
-----------------------
index.xml:
<?xml version="1.0"?>
<!DOCTYPE page[
<!ENTITY navtree SYSTEM "nav.xml">
]>
<page xmlns:xform="ht tp://cfconsulting.ca/xmlform/1.0"> ^^^^^^^
xform.xsl:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:xform="ht tp://cfconsulting.ca/xform/1.0">

^^^^^^
so the namespace here is different.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
On Sun, 11 Jan 2004 12:18:13 +0100, Martin Honnen wrote:
xform.xsl:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:xform="ht tp://cfconsulting.ca/xform/1.0">

^^^^^^
so the namespace here is different.


Sigh. I knew it would be something stupid. It's so easy to overlook the
obvious. Thanks!

cf
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2787
by: Greg Wogan-Browne | last post by:
Hi all, I am having some trouble figuring out what is going on here - is this a bug, or correct behaviour? Basically, when I create an XML document with a namespace using xml.dom.minidom.parse() or parseString(), the namespace exists as an xmlns attribute in the DOM (fair enough, as it's in the original source document). However, if I use the DOM implementation to create an identical document with a namespace, the xmlns attribute is not...
4
8130
by: cyclops | last post by:
I'm trying to do XML + XSLT -> Another XML. The source XML contains multiple namespaces and XSLT will handle all possible tags under each name space. ----source---- <document xmlns="..." xmlns:a="..." xmlns:b=""> .... ----XSLT---- ....
12
9502
by: Sammy | last post by:
Hi, my mind is going crazy. I have tried everything I can think of to no avail. I have tried Disable Output Escaping. I tried to think of a way of enclosing the attribute data in a CDATA element. That did not parse. Here is my question: How can I get attribute values to not get converted from &apos; to '
1
363
by: Wil | last post by:
I'm very new to developing in .NET and even newer to XML. The past few days have been pretty frustrating for me because I'm trying to perform a transform on data in a dataset and it's not working. Basically, all of the data is stored in an Access .mdb that is read into a dataset when the application is loaded. There are some minor changes to the schema between what is in the physical database to accomodate some things that Access just...
19
16280
by: David Thielen | last post by:
Hi; If there are no namespaces this works fine for me. But if the xml has namespaces, then I get either no node back or an exception. Here is the sample xml: <root xmlns="http://www.test.org" xmlns:sns="http://www.test.org/sub" xmlns:mns="http://www.test.org/mini"> <data>
4
9060
by: David S. Alexander | last post by:
How can I do simple subtraction in an XSLT. I want to read a few attribute values from an XML document, calculate their difference, and transform that value to an attribute in the XML output document. My original XML is, <Dates> <Birth Year="1966" />
1
1890
by: Rajesh | last post by:
I am trying to pass the namespace, which is in my Original Message, to a Java method for further processing. In the original message the xmlns:xenc namespace is present. I make a call to Java function and pass the whole XML message along with tags and values. In my Java function when I tried to print the XML message which is receieved by the XSLT proc. it has omitted the xmlns:xenc namespace which is creating a problem in Java function for...
0
11566
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11153
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10687
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9886
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8253
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6112
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6331
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4941
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3541
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.