xsl-list
[Top] [All Lists]

RE: [xsl] Using XPath to refer to a tag value which itself is XML content

2010-01-05 04:18:45

The only way I could explain what you are seeing is if the contents of the
Rawdata element are enclosed in <![CDATA[...]]>. If the content were as you
have shown it, then with <root> as the context node,

<xsl:value-of select="Rawdata"/>

would output the string value of the Rawdata element, which is
auto_21259132, and the instruction 

<xsl:value-of 
    select="Rawdata/report/primaryImages/primaryImage/ObjectName"/>

would output exactly the same.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 


Hi,
I have a XML file content which is added as the value of XML tag.

For eg:
In this xml snippet, value of tag <RawData> is xml content itself.

<root>
<OID>27696.16415.10544.53961</OID>
<Rawdata>
<report><primaryImages><primaryImage><ObjectName>auto_21259132
174955</ObjectName></primaryImage></primaryImages></report>
</Rawdata>
</root>

Now, if I use XPath to navigate through this XML content, it 
does not display anything.
...
   <xsl:value-of 
select="Rawdata/report/primaryImages/primaryImage/ObjectName"/>
...

But, if I use below XPath, it gives the entire XML content.
...
   <xsl:value-of select="Rawdata"/>
...

How should I add such value so that Xpath can consider it as XML?

Thanks
arvind


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>