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

Re: namespace

Subject: Re: namespace
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 21 Jun 2002 16:05:10 +0100
Re:  namespace
Hi Nick,

> When i run my stylesheet I have been getting a namespace error for
> <ref:SECTION GIDR="t_28_part_0_00004"/>.
> It says the namespace ref is not declared. in my attemps to fix
> this, the only way i could get it to work was by adding
> xmlns:ref="http://nothing to the <SUBPART GID="t_28_part_0_00003"
> PARENT-GIDR="t_28_part_0" CHRCNT="6930"> in the xml file.

XSLT cannot operate on any old XML files. As well as being well
formed, the XML files have to adhere to the XML Namespaces
Recommendation. What that means is that you can't use colons in
element and attribute names willy-nilly -- you can only use them if
you're using them to separate a prefix from a local part of an element
or attribute name. And the prefix has to be declared with a namespace
declaration.

If the XML files that you're working with *don't* adhere to the XML
Namespace Recommendation then you can't use XSLT with them. The best
thing that you can do is either add the namespace declaration to the
files (preferably with a meaningful namespace name) or stop using
colons in the element names (perhaps replace ref:SECTION with
ref.SECTION instead).

You could get round editing the existing files by generating XML
documents that use entities to pull in the existing files, something
like:

<!DOCTYPE wrapper [
<!ENTITY file SYSTEM 'file.xml'>
]>
<wrapper xmlns:ref="http://www.example.com/">
  &file;
</wrapper>

but creating one of these for each of your files is likely to be just
as much trouble as editing the files you have.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • namespace
    • nrashidi - Fri, 21 Jun 2002 10:26:34 -0400 (EDT)
      • David Carlisle - Fri, 21 Jun 2002 10:52:33 -0400 (EDT)
      • Jeni Tennison - Fri, 21 Jun 2002 11:05:10 -0400 (EDT) <=

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.