Re: [xsl] Namespaces

Subject: Re: [xsl] Namespaces
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 09 Jun 2003 14:46:17 -0400
At 2003-06-09 14:16 -0400, David Totten wrote:
Given the following xml,
...
<!DOCTYPE article PUBLIC "-//ES//DTD journal article DTD version
5.0.1//EN//XML" "art501/art501.dtd">
<article docsubtype="fla" xml:lang="en">

You don't show your DTD, but I'm guessing the declarations for <article> include a default namespace declaration.


<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:ce="http://www.elsevier.com/xml/common/dtd";
    xmlns:sb="http://www.elsevier.com/common/struct-bib/dtd";
    xmlns="http://www.w3.org/TR/REC-html40";>
...
        <TITLE>
          <xsl:value-of select="article/item-info/ce:pii"/>
        </TITLE>
...
I would love to know how to get a value for my <TITLE> tag. What am I doing
wrong, or misunderstanding?

Perhaps you are forgetting that unprefixed names in XPath 1.0 expressions do not utilize the default namespace and are always assumed to be in no namespace ... even if your source document is using the default namespace.


If an element in your source node tree is using any namespace, you are obliged to prefix the node name in XPath 1.0 expressions.

I hope this helps.

............... Ken



--
Upcoming hands-on courses: (registration still open!)
-      (XSLT/XPath and/or XSL-FO) North America: June 16-20, 2003

G. Ken Holman                mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                      Definitive XSLT and XPath
ISBN 0-13-140374-5                              Definitive XSL-FO
ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X              Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners:    http://XMLGuild.info
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc


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



Current Thread