[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: how to get the value ?


Subject: Re: how to get the value ?
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Wed, 31 May 2000 16:42:24 +0100

==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



Current Thread
Keywords