|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Problem with selecting nodes
Hello everyone! I have problem that I don't know how to solve (as usually :-) In my application user should choose attributes which he wants to be displayed, e.g. key1 and key3 Than my XSL should select only element ccc with key="key1" or key="key3" with highest priority. In my example that should be in element bbb i="1": <ccc key="key3" priority="3"> <color>FF0000</color> </ccc> in element bbb i="2": <ccc key="key1" priority="1"> <color>0000FF</color> </ccc> because user has chosen only key1 and key3 Here is my sample XML: <?xml version="1.0" encoding="UTF-8"?> <aaa> <bbb i="1"> <ccc key="key1" priority="1"> <color>0000FF</color> </ccc> <ccc key="key2" priority="2"> <color>00FF00</color> </ccc> <ccc key="key3" priority="3"> <color>FF0000</color> </ccc> </bbb> <bbb i="2"> <ccc key="key1" priority="1"> <color>0000FF</color> </ccc> <ccc key="key2" priority="2"> <color>00FF00</color> </ccc> </bbb> </aaa> I have tried with this XSL: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="key1" select="1"/> <xsl:param name="key2" select="0"/> <xsl:param name="key3" select="1"/> <xsl:template match="/"> <xsl:apply-templates select="aaa/bbb"/> </xsl:template> <xsl:template match="bbb"> <xsl:apply-templates select="ccc[($key1 and @key='key1') or ($key2 and @key='key2') or ($key3 and @key='key3')]"> </xsl:apply-templates> </xsl:template> </xsl:template> which select only elements bbb with atribut key which user has selected, but doesn't select only element bbb with highest priority. Result is: in element bbb i="1": <ccc key="key1" priority="1"> <color>0000FF</color> </ccc> <ccc key="key3" priority="3"> <color>FF0000</color> </ccc> in element bbb i="2": <ccc key="key1" priority="1"> <color>0000FF</color> </ccc> Any suggestions are apprecited. Thanks in advance, Denis Kranjcec XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








