Subject: [xsl] Problem with selecting nodes From: "Denis Kranjcec" <denis.kranjcec@xxxxxx> Date: Mon, 8 Oct 2001 16:49:12 +0200 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] running saxon on commandl, Joerg Pietschmann | Thread | Re: [xsl] Problem with selecting no, Jeni Tennison |
Re: [xsl] how can I, include a HTML, Thomas B. Passin | Date | RE: [xsl] Comparision of parsers, Chris Bayes |
Month |