Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XML & XSLT namespaces

Reply
Thread Tools

XML & XSLT namespaces

 
 
Colin Fox
Guest
Posts: n/a
 
      01-11-2004
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 xmlnsform="http://cfconsulting.ca/xmlform/1.0">
<title>Page Title</title>
<navtree>&navtree;</navtree>
<body>
<sect>
<title>Form Test</title>
<p>Form follows this:</p>
<xform:form>
<xform:textwidget name='test_text' value='a test value'/>
<xform:buttonwidget name='test_but' value='Submit'/>
</xform:form>
</sect>
</body>
</page>
-----------------
xform.xsl:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform"
xmlnsform="http://cfconsulting.ca/xform/1.0">

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

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

<xsl:template match="xform:buttonwidget">
<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
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      01-11-2004


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 xmlnsform="http://cfconsulting.ca/xmlform/1.0">

^^^^^^^

> xform.xsl:
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsl:stylesheet version="1.0"
> xmlnssl="http://www.w3.org/1999/XSL/Transform"
> xmlnsform="http://cfconsulting.ca/xform/1.0">

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


--

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

 
Reply With Quote
 
 
 
 
Colin Fox
Guest
Posts: n/a
 
      01-11-2004
On Sun, 11 Jan 2004 12:18:13 +0100, Martin Honnen wrote:

>> xform.xsl:
>> <?xml version="1.0" encoding="iso-8859-1"?>
>> <xsl:stylesheet version="1.0"
>> xmlnssl="http://www.w3.org/1999/XSL/Transform"
>> xmlnsform="http://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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem to insert an XML-element by XSLT-converting from one XML-file into another XML-file jkflens XML 2 05-30-2006 09:41 AM
Including XSLT/XML document within a XSLT document dar_imiro@hotmail.com XML 4 12-13-2005 02:26 AM
Clarification on XML parsing & namespaces (xml.dom.minidom) Greg Wogan-Browne Python 1 01-28-2005 03:19 AM
ANN: New low-cost XML Editor, XSLT Editor, XSLT Debugger, DTD/Schema Editor Stylus Studio Java 0 08-03-2004 03:53 PM
Newbie: XML 2 XML and namespaces Mark Smits XML 2 09-21-2003 09:51 PM



Advertisments