Hi,
Your XML seems to be corrupt:
<text>Condition 1</height>
If you use this XML:
<data>
<list1>
<text>Condition 1</text>
<height>5inch</height>
<width>10inches</width>
<color>black</color>
<list2>
<text>Condition 2</text>
<height>2inch</height>
<width>4inches</width>
<color>white</color>
<img src=""></img>
</list2>
</list1>
</data>
the following XSLT outputs the contents of the <text> child of the listX
node matching the color parameter:
<xsl:param name="color" select="'white'"/> <!-- input parameter -->
<xsl:template match="*[starts-with(name(),'list')]">
<xsl:if test="color/text()=$color">
<xsl:value-of select="text"/>
</xsl:if>
<xsl:apply-templates select="*[starts-with(name(),'list')]"/>
</xsl:template>
By introducing more parameters + extending the xsl:if and modifying the
xsl:value you hopefully will achieve what you want.
- Per.
-----Opprinnelig melding-----
Fra: ms [mailto:mina_hurray(_at_)yahoo(_dot_)com]
Sendt: 13. november 2006 17:28
Til: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Emne: [xsl] Question about data filter using XSLT
Hello:
I am passing three paramters to my XSLT and based on
these paramters and the corresponsing conditions on
the XML, only the data corresponsing to these
paramters should be displayed.
Example:
I have height, weight, color as three parameters which
I pass on th style sheet.
Now, in the actual content (the XML), these paramters
are present as well:
<list1>
<text>Condition 1</height>
<width>10inches</width>
<color>black</color>
<list2>
<text>Condition 2</text>
<height>2inch</height>
<width>4inches</width>
<color>white</color>
<img src=""/>
</list2>
</list1>
Now suppose the paramters height, width and color
passed on style sheet have values 2,4 and white then
only content of <list2> and image associated with it
should be displayed.
How can this be achieved on the style sheet? I ahev
tried passing parameters at template levels but it
does not work. Please do give me some ideas. Thanks in
advance for all your help.
____________________________________________________________________________
________
Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--