[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Filtering nodes based on name and value


Subject: [xsl] Filtering nodes based on name and value
From: Fabien Tillier <ftillier@xxxxxxxx>
Date: Mon, 2 Apr 2012 09:51:18 +0000

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


Current Thread