This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: how to get the value ?
- To: xsl-list at mulberrytech dot com
- Subject: Re: how to get the value ?
- From: Francis Norton <francis at redrice dot com>
- Date: Wed, 31 May 2000 16:42:24 +0100
- References: <D0AEC25740AAD311800A009027ABDBAE10085D@MR-GARISON>
- Reply-To: xsl-list at mulberrytech dot com
==Off-Line==
Heather,
Are you *sure* about this?
Isn't this (elements with both child elements and text nodes) simply
mixed-content as described in
http://www.w3.org/TR/REC-xml#sec-mixed-content ?
Not done much in the DP world, I admit, but a bit hard to implement
XHTML without it...
You may want to get your corrections in first!
Francis.
Heather Lindsay wrote:
>
> " 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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list