I'm working with 2 XML documents, and trying to get a value from one document into the other if a variable is matched. The first XML document is a converted spreadsheet formatted like:
<Doc1>
<row>
<cell>VA15</cell>
<cell>wr23</cell>
</row>
<row>
<cell>VA45</cell>
<cell>wr27</cell>
</row> <row>
<cell>VA78</cell>
<cell>wr24</cell>
</row>
</Doc1>
The second XML document is a longer one inside of which there's an id
element matching one part of the spreadsheet:
<Doc2>
<p> text text text
<id>wr23</id>
</p>
</Doc2>
I'm trying with my xslt transformation to test to see if the id
element matches the value of a cell
in doc1 it pulls the value of the preceding cell
. In this case I'd like the xslt transformation to output "VA15". I've tried various permutations of the following code without success, does anyone have any ideas?
<xsl:for-each select="document('Doc1.xml')//row">
<xsl:if test="/cell=//id'">
<xsl:value-of select="/preceding-sibling::cell"/>
</xsl:if>
</xsl:for-each>