xsl-list
[Top] [All Lists]

[xsl] Filtering nodes based on name and value

2012-04-02 04:51:47
Hi List

I would like to be able to filter a node by its value, but this node itself is 
unknown at the time of writing the xsl.

<xml>
        <row>
        <N100>5</N100>
            <N101>2</N101>
              <N102>3</N102>
        </row>
      <row>
        <N100>4</N100>
                <N101>5</N101>
              <N102>6</N102>
      </row>
        <row>
                <N100>7</N100>
                <N101>8</N101>
                <N102>5</N102>
      </row>
</xml>

I would like to be able to select row nodes based on "name of the node is N101" 
(for example) and value is 5, but the name N101 is given as a parameter to a 
template.
Thus  it should be something like <xsl:value-of select="row[$param = 5]"/>, 
which doesn't work, though <xsl:value-of select="row[N101 = 5]"/> does.
($param being equal to 'N101').

And I would like to have
<row>
      <N100>4</N100>
      <N101>5</N101>
      <N102>6</N102>
</row>                
(not using value-of of course, only for the sake of the example ;) 
Any help would be much appreciated.

Best regards,
Fabien



--~------------------------------------------------------------------
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>
--~--


<Prev in Thread] Current Thread [Next in Thread>