I have XML file:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<Data>
<Records>
<Record>
<AddInfo>
<Info>
</Info>
</AddInfo>
</Record>
</Records>
</Data>
and XSL file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:template match="Dane">
<html>
<link rel="stylesheet" type="text/css" href="report.css"></link>
<body>
<table border="1" cellspacing="0">
<tr>
<th>XXX</th>
</tr>
<xsl:for-each select="Records/Record">
<tr>
<td><xsl:value-of select="XXX"/></td>
</tr>
</xsl:for-each>
</table>
<table border="1" cellspacing="0">
<tr>
<th>YYY</th>
<th>ZZZ</th>
</tr>
<xsl:for-each select="Records/Record/AddInfo/Info">
<tr>
<td><xsl:value-of select="YYY"/></td>
<td><xsl:value-of select="ZZZ"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
And I want to make it like this: if node exists, display table with "Info" nodes, and if not, display SOME TEXT.
I've been trying
<xsl:if test="following-sibling::AddInfo">
</xsl:if>
and
<xsl:if test="AddInfo">
</xsl:if>
But it is not working.
I want it like this:
Table1
| | | |
(condition: if inside XML will be node, I want to display second table, under Table1)
SecondTable
| | |
How I can do this?
Thanks for any help, regards.
No comments:
Post a Comment