Subject: [xsl] RE: Problems accessing child elements in template From: "Setera, Craig" <Craig.Setera@xxxxxxxxxxxx> Date: Thu, 14 Feb 2002 08:18:32 -0600 |
Peter Davis wrote: > 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? Thanks so much. This was it. I guess being a newbie to all of this I did not realize that the namespace prefixes are expanded before they are matched. The namespace definitions were different between the style sheet and the XML to be translated and therefore they were not matching. Of course the other namespaces matched, so it was more confusing because some things were being matched. A learning experience! Thanks, Craig -----Original Message----- From: Setera, Craig Sent: Wednesday, February 13, 2002 2:54 PM To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx' Subject: Problems accessing child elements in template 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] a rather stupid question abou, 林 子芯 | Thread | [xsl] how to select the same attrib, Jakub . Valenta |
Re: [xsl] alternate row color in a , Eric van der Vlist | Date | RE: [xsl] Elements with Mixed conte, Andrew Welch |
Month |