|
Subject: Re: [xsl] need to get value of required nodes only From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Mon, 8 Mar 2004 09:40:59 +0000 |
Hi Qazi,
> i m getting a xml like this now i want to get the value of test2 and
> test 4 Main Nodes. and all sub links of these two main nodes. and
> just want two print like this
[snip]
You can select the two <menu-heads> elements that you're interested in
using a predicate that tests true for those two elements. I guess that
the best predicate to use would be one based on their menunumber
attribute; something like:
menu-heads[@menunumber = 1 or @menunumber = 3]
If you apply templates to only those <menu-heads> elements, then those
are the only ones that will be processed. You need something like:
<xsl:template match="menu-options">
<xsl:apply-templates select="menu-heads[@menunumber = 1 or
@menunumber = 3]" />
</xsl:template>
<xsl:template match="menu-heads">
<xsl:value-of select="@name" />
<xsl:text>
</xsl:text>
<xsl:apply-templates select="sublinks" />
</xsl:template>
<xsl:template match="sublinks">
<xsl:text>	</xsl:text>
<xsl:value-of select="." />
<xsl:text>
</xsl:text>
</xsl:template>
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] need to get value of required, Asim Qazi | Thread | Re: [xsl] need to get value of requ, Asim Qazi |
| Re: [xsl] What is the best XSLT boo, Jeni Tennison | Date | RE: [xsl] Please help. fixing white, Andrew Welch |
| Month |