[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Printing all child bachelor nodes
Subject: Re: Printing all child bachelor nodes
From: Douglas F Shearer <dougal.s@xxxxxxxxx>
Date: Thu, 9 Feb 2006 15:52:06 +0000
|
I have one more query, is there anyway I could have ONLY the beds in
bold?
Thanks.
Dougal.
Douglas F Shearer
dougal.s@xxxxxxxxx
http://douglasfshearer.dyndns.org
On 9 Feb 2006, at 15:28, andrew welch wrote:
On 2/9/06, Douglas F Shearer <dougal.s@xxxxxxxxx> wrote:
Hi there.
I have the following snippet of XML and would like to extract the
data given below using XSL...
********** XML ************
<features>
<pool length="30" max-depth="160" min-depth="30"
indoor="false"/>
<DVD/>
<beds twin="2" sofa-bed="1"/>
</features>
******** REQUIRED OUTPUT ******
pool: length: 30, max-depth:160, min-depth:30, indoor: false.
DVD.
beds: twin:2, sofa-bed:1
**************************************
The main issue I am having is that the nodes themselves change
(microwave instead of DVD etc). Basically I want to print out all of
the elements within the features element, and their associated
attributes.
<xsl:template match="features/*">
<xsl:value-of select="local-name()"/>
<xsl:for-each select="@*">
<xsl:value-of select="concat(' ', name(), ':', .)"/>
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
<xsl:text>.</xsl:text>
</xsl:template>
Did you really want text output? If so you will need to add CRs in
there, but I'm guess you'll be using HTML. Also, beds didn't end with
a . which I'm also assuming was a typo.
cheers
andrew
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|