Hi,
I am using xslt version 1.0 and MSXML
I have created an xslt to display a list of header parameters but my code is not quite doing what I need and I would appreciate some help.
This is the desired output:
<DIV style="MARGIN-TOP: 20px; MARGIN-BOTTOM: 20px" id=dvParams>
<DIV>Study Title: </DIV>
<DIV>reader type selected</DIV>
<DIV>exposure type selected</DIV>
<DIV>Demo: demo selected</DIV>
<DIV>Rx Class: Rx Class Selected</DIV>
<DIV>Cost: </DIV>
<DIV>A-Size: ad page selected</DIV>
<DIV>Tabloid: ad page selected</DIV>
<DIV>Frequency BW: BW Selected, Color: Color Selected </DIV>
<DIV>CPM Emphasis: 50</DIV>
</DIV>
This is what my xslt outputs:
<DIV style="MARGIN-TOP: 20px; MARGIN-BOTTOM: 20px" id=dvParams>
<DIV>Study Title: </DIV>
<DIV>reader type selected</DIV>
<DIV>exposure type selected</DIV>
<DIV>Demo: demo selected</DIV>
<DIV>Rx Class: Rx Class Selected</DIV>
<DIV>Cost: </DIV>
<DIV>A-Size: ad page selected</DIV>
<DIV>Tabloid: ad page selected</DIV>
<DIV>Frequency BW: BW Selected</DIV>
<DIV>Color: Color Selected</DIV>
<DIV>CPM Emphasis: 50</DIV>
</DIV>
I need the
Frequency BW: BW Selected and
Color: Color Selected to be displayed in the same DIV with a comma separating their values instead of using two DIV tags.
Please note that this applies only when the @col attribute is 2 and the @row value is equal to the preceding @row.
The xml extract below has the @col = 2 and row = 4. Therefore, I need them to be in the same DIV.
<Parameter name="Frequency BW" value="BW Selected" col="2" row="4" />
<Parameter name="Color" value="Color Selected" col="2" row="4" />
This is the xslt I am using:
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="//ReportParams">
<xsl:for-each select="Parameter">
<div>
<xsl:choose>
<xsl:when test ="@title = 'true'">
<b><xsl:value-of select="@name"/></b>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@name != '' and @value != ''">
<xsl:text>: </xsl:text>
</xsl:if>
<xsl:value-of select="@value"/>
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
This is the xml
<ReportParams>
<Parameter name="Study Title" value="" title="true" col="1" row="1" />
<Parameter name="" value="reader type selected" col="1" row="2"/>
<Parameter name="" value="exposure type selected" col="1" row="3"/>
<Parameter name="Demo" value="demo selected" col="1" row="4"/>
<Parameter name="Rx Class" value="Rx Class Selected" col="1" row="5"/>
<!-- for efficiency report -->
<Parameter name="Cost" value="" col="2" title="true" row="1" />
<Parameter name="A-Size" value="ad page selected" col="2" row="2"/>
<Parameter name="Tabloid" value="ad page selected" col="2" row="3" />
<Parameter name="Frequency BW" value="BW Selected" col="2" row="4" />
<Parameter name="Color" value="Color Selected" col="2" row="4" />
<Parameter name="CPM Emphasis" value="50" col="2" row="5" />
</ReportParams>