I am wanting to change my XSL stylesheet to select all the formattedreportobjects that have a <FormattedReportObject type="CTFormattedField" Type="string" FieldName="{VhStock.MAKE}"> value that = Mitsubishi.
At the moment its just outputting all the FormattedReportObjects. Any help would be appreciated.
XML file
<FormattedReportObjects>
<FormattedReportObject type="CTFormattedField" Type="string" FieldName="{VhStock.MAKE}">
<ObjectName>Field81</ObjectName>
<FormattedValue>MITSUBISHI</FormattedValue>
<Value>MITSUBISHI</Value>
</FormattedReportObject>
<FormattedReportObject type="CTFormattedField" Type="string" FieldName="{VhStock.model_name}">
<ObjectName>Field83</ObjectName>
<FormattedValue>MAGNA</FormattedValue>
<Value>MAGNA</Value>
</FormattedReportObject>
</FormattedReportObjects>
<FormattedReportObjects>
<FormattedReportObject type="CTFormattedField" Type="string" FieldName="{VhStock.MAKE}">
<ObjectName>Field81</ObjectName>
<FormattedValue>DAEWOO</FormattedValue>
<Value>DAEWOO</Value>
</FormattedReportObject>
<FormattedReportObject type="CTFormattedField" Type="string" FieldName="{VhStock.model_name}">
<ObjectName>Field83</ObjectName>
<FormattedValue>LANOS</FormattedValue>
<Value>LANOS</Value>
</FormattedReportObject>
</FormattedReportObjects>
Here is my current XSL file
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="/">
<html>
<basefont face="Verdana" size="2"/>
<body>
<h2>Used Vehicles</h2>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="FormattedReportObjects">
<table border="0">
<xsl:apply-templates/>
</table>
</xsl:template>
<xsl:template match="FormattedReportObject">
<tr>
<xsl:apply-templates select="Value"/>
</tr>
</xsl:template>
<xsl:template match="Value">
<td bgcolor="#E1E1E1" width="200">
<xsl:if test="parent::FormattedReportObject[@FieldName = '{VhStock.MAKE}']">
<xsl:text>Make</xsl:text>
</xsl:if>
<xsl:if test="parent::FormattedReportObject[@FieldName = '{VhStock.model_name}']">
<xsl:text>Model Name</xsl:text>
</xsl:if>
</td>
<td>
<xsl:value-of select="text()"/>
</td>
</xsl:template>
</xsl:stylesheet>
Thanks for your time
At the moment its just outputting all the FormattedReportObjects. Any help would be appreciated.
XML file
<FormattedReportObjects>
<FormattedReportObject type="CTFormattedField" Type="string" FieldName="{VhStock.MAKE}">
<ObjectName>Field81</ObjectName>
<FormattedValue>MITSUBISHI</FormattedValue>
<Value>MITSUBISHI</Value>
</FormattedReportObject>
<FormattedReportObject type="CTFormattedField" Type="string" FieldName="{VhStock.model_name}">
<ObjectName>Field83</ObjectName>
<FormattedValue>MAGNA</FormattedValue>
<Value>MAGNA</Value>
</FormattedReportObject>
</FormattedReportObjects>
<FormattedReportObjects>
<FormattedReportObject type="CTFormattedField" Type="string" FieldName="{VhStock.MAKE}">
<ObjectName>Field81</ObjectName>
<FormattedValue>DAEWOO</FormattedValue>
<Value>DAEWOO</Value>
</FormattedReportObject>
<FormattedReportObject type="CTFormattedField" Type="string" FieldName="{VhStock.model_name}">
<ObjectName>Field83</ObjectName>
<FormattedValue>LANOS</FormattedValue>
<Value>LANOS</Value>
</FormattedReportObject>
</FormattedReportObjects>
Here is my current XSL file
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="/">
<html>
<basefont face="Verdana" size="2"/>
<body>
<h2>Used Vehicles</h2>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="FormattedReportObjects">
<table border="0">
<xsl:apply-templates/>
</table>
</xsl:template>
<xsl:template match="FormattedReportObject">
<tr>
<xsl:apply-templates select="Value"/>
</tr>
</xsl:template>
<xsl:template match="Value">
<td bgcolor="#E1E1E1" width="200">
<xsl:if test="parent::FormattedReportObject[@FieldName = '{VhStock.MAKE}']">
<xsl:text>Make</xsl:text>
</xsl:if>
<xsl:if test="parent::FormattedReportObject[@FieldName = '{VhStock.model_name}']">
<xsl:text>Model Name</xsl:text>
</xsl:if>
</td>
<td>
<xsl:value-of select="text()"/>
</td>
</xsl:template>
</xsl:stylesheet>
Thanks for your time