XML choose issue

Self build / N/A
March 21, 2011 at 16:12:39
Specs: Vista Ultimate, SP1, 3.0Ghz,2Ghz
I am putting together an XML document displaying the features of different monitors. I want an image of the monitor displayed. This is the code:

<xsl:when test="/monitors/monitor/company/model='2310e'">


When I run this, nothing displays for the image. Advice?

See More: XML choose issue

Report •

March 21, 2011 at 16:15:16
In the above post, the html img tag was removed when I posted, but assume it's there!

Report •

March 21, 2011 at 19:34:21
Hmm, is '/monitors/monitor/company' unique?

Which xsl:template are you in at this point?

The test= should be relative to the current template or for-each iteration, no? Unless there's only one '/monitors/monitor/company' in the data ... ?

Report •

March 22, 2011 at 07:02:53
The template at this point is "monitor". So far, there are two monitors in the table and I want to display the appropriate image for each monitor. So, I should use the following?:

<xsl:when test="/monitor/company/model='2310e'">

<xsl:when test="/monitor/company/model="BX2231">


Report •

Related Solutions

March 22, 2011 at 07:41:06
I solved the problem! Apparently you don't need to enter the full path to the node. The when statement should be:

<xsl:when test="model='2310e'">

As long as your're in the right template and the node you're interested is in that template, you only have to specify the name of the node; path to the node is not necessary.

Report •

Ask Question