|
Subject: RE: how to get the value ? From: Heather Lindsay <heather.lindsay@xxxxxxxxxxxxx> Date: Wed, 31 May 2000 10:36:20 -0400 |
" xml structure
<?xml version="1.0"?>
<first>
<second> data1
<child att="x">data2</child>
</second>
</first>
I want to fetch the values "data1" and "data2" ."
The above is not well-formed XML because elements with child elements cannot
also have a text element. You could either have another child element with
"data1" in it or set "data1" as the value of an attribute in your "second"
element (<second attrib=data1>). For learning XSLT, I strongly recommend
THE book, "XSLT Programmer's Reference" by Mike Kay (published by Wrox).
You will probably need to order the book online as it is still very new and
not yet in very many book stores.
If your XML doc. was as follows:
<first>
<second>
<child1> data1 </child1>
<child2 att="x">data2</child2>
</second>
</first>
Then the following XSL would get the values you want:
<xsl:stylesheet .............>
<xsl:template match="/">
<HTML>
<BODY>
<p><xsl:value-of select="second/child1"/></p>
<p><xsl:value-of select="second/child2"/></p>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
Producing the following HTML:
<HTML>
<BODY>
<p> data1 </p>
<p> data2 </p>
</BODY>
</HTML>
Good luck,
Heather
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| how to get the value ?, Dhiraj Guglani | Thread | Re: how to get the value ?, Francis Norton |
| Re: === Identifying a unique node i, Khalid Asad | Date | Re: disabling output escaping with, Mike Brown |
| Month |