Re: [xsl] Problems accessing child elements in template

Subject: Re: [xsl] Problems accessing child elements in template
From: Peter Davis <pdavis152@xxxxxxxxx>
Date: Wed, 13 Feb 2002 14:38:36 -0800
First thing I would do is check the namespace declarations in both your input 
XML and the stylesheet.  It's possible to have an element called dc:title in 
your input that does not match dc:title in your XSL if the namespaces do not 
match; check for typos.

If that doesn't work, could you post the relavent snippet of your input and 
xsl?

On Wednesday 13 February 2002 12:54, Setera, Craig wrote:
> 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

-- 
Peter Davis
You are going to have a new love affair.


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


Current Thread