I have the following XSL:
<xsl:key name="Hosts" match="Report/Host" use="ID"/>
...
<xsl:for-each select="Report/Host[count(. | key('Hosts', ID)[1]) = 1 and Factor = 8]">
<xsl:variable name="ThisID" select="ID" />
<xsl:for-each select="/Report/Host[count(. | key('Hosts', Name)[1]) = 1]">
<xsl:for-each select="key('Hosts', Name)[ID = $ThisID]">
<xsl:value-of select="Name"/>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
When I run it through FOP 1.1 (not sure if fop is to blame here), I get this error:
SEVERE: org.xml.sax.SAXParseException; systemId: file:/C:/temp/fop/fop-1.1/pdf-report.xml; lineNumber: 243; columnNumber: 180; java.lang.RuntimeException: Variable not resolvable: ThisID
...
; SystemID: file:/C:/temp/fop/fop-1.1/pdf-report.xml; Line#: 243; Column#: 180
javax.xml.transform.TransformerException: java.lang.RuntimeException: Variable not resolvable: ThisID
Line 243, is this line:
<xsl:for-each select="Report/Host[count(. | key('Hosts', ID)[1]) = 1 and Factor = 8]">
I cannot see why this doesn't work
I finally found the error, it was not because of this element, Xalan is just not good at telling you the problem.
I had an error before it, which didn't cause a "stop" to the rendering, but did cause any additional xsl:variable to go unprocessed, an in turn, not allow anything to reference them.
The debugging went like this:
XSL statement:
<xsl:variable name="HostURIRequestSuffix">
<xsl:if test="/Report/Scan/ScanDetails/SelectedHostReport = 'true'">
<xsl:call-template name="GetHostsURL"/>
</xsl:if>
</xsl:variable>
And this error:
file:/C:/temp/fop/fop-0.95/pdf-report.xml; Line #20; Column #48; org.xml.sax.SAXException: ElemTemplateElement error: GetHostsURL
javax.xml.transform.TransformerException: ElemTemplateElement error: GetHostsURL
For some reason, this causes any additional xsl:variable to get ignored, while the rest of the rendering works perfectly, once I fixed this, everything works, thanks guys for the help