[xsl] Problems accessing child elements in template

Subject: [xsl] Problems accessing child elements in template
From: "Setera, Craig" <Craig.Setera@xxxxxxxxxxxx>
Date: Wed, 13 Feb 2002 14:54:08 -0600
Hello,

I am a relative newbie, but I've spent some time looking through the FAQ and
still cannot understand what I might be doing wrong.  I don't seem to be
able to access the text of a child node that really appears to be there.
I'm afraid this might have something to do with namespaces which gets even
further from my real knowledge.

I found the Trace logging stuff in Xalan and have been using it to try to
figure out what is going on.  Why would it be that:

<xsl:copy-of select="." /> in the current context yields the following in
the trace:
file:///c:/temp/ocs.xsl Line #31, Column #29: copy-of, select='.': 
     10015: rdf:description
STARTELEMENT: rdf:description
CHARACTERS:         
       
STARTELEMENT: dc:title
CHARACTERS: Moreover3Mnews
ENDELEMENT: dc:title

And yet, <xsl:copy-of select="./dc:title" /> in the same context yields:
file:///c:/temp/ocs.xsl Line #32, Column #38: copy-of, select='./dc:title': 
     [empty node list]

The trace for the first call shows very obviously that "dc:title" element is
in the current context and yet I can't select it.  I know I must be missing
something very basic here.

Finally, the following actually extracts the text I'm looking for, even
though I'm sure I can't be guaranteed that the elements are always in the
same order.
file:///c:/temp/ocs.xsl Line #32, Column #39: copy-of, select='*[1]/text()':

     10019: #text
CHARACTERS: Moreover3Mnews

Thanks for any help that can be offered.
Craig



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


Current Thread