Re: [xsl] namespace problem

Subject: Re: [xsl] namespace problem
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Sun, 22 Apr 2001 16:43:49 +0100

> I got an xml file with namspace
> <?xml version="1.0" encoding="gb2312"?>
> <?xml-stylesheet type="text/xsl" href="sortsample.xsl"?>
> <a:bookinfo xmlns:a="";>
> then how should i write proper XSLT file to retrieve information
> from this document?

You need to define the same namespace in the XSLT stylesheet as well,
and give it a prefix.  It doesn't matter what prefix you use, but you
may find it easiest to use the same one as you use in the XML
document, just to avoid confusion.  So something like:

<xsl:stylesheet version="1.0"

Then you can do things like select the books in the catalog with:


> if i use defaul namespace as
> xmlns=">", how should i do same thing
> as above?

In the same way as above.  The important thing is that while you can
use the default namespace in the XML document, you *must* declare a
prefix for it in the XSLT stylesheet.

I hope that helps,


Jeni Tennison

 XSL-List info and archive:

Current Thread