Modify value of an Attribute using XSLT
Posted: Fri Dec 11, 2020 3:33 am
I am generating a Graph from Oracle Reports which is working well as far as plotting the points. However, I have hit a brick wall while working with XSLT (Complete novice here in the field). The Attribute markerShape is used to plot the different symbols in the Graph. However, because my Data is dynamic, I have to achieve this using XSLT.
What I am trying to achieve: I have a column called category which is based on a Query in Oracle Reports. The rules are as follows:
What I am trying to achieve: I have a column called category which is based on a Query in Oracle Reports. The rules are as follows:
- When category = 1 then markerShape = 'MS_CIRCLE'
When category = 2 then markerShape = 'MS_DIAMOND'
When category = 3 then markerShape = 'MS_SQUARE'
When category = 4 then markerShape = 'MS_PLUS'
Code: Select all
<rw:graph id="CT_1" src="G_category" groups="x_date" dataValues="category">
<!--
<?xml version="1.0" ?>
<Graph version="2.6.0.23" graphType="LINE_VERT_ABS">
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:param name="pNewMarkerShape" select="'MS_CIRCLE'"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="SeriesItems/Series/@markerShape">
<xsl:attribute name="markerShape">
<xsl:value-of select="$pNewMarkerShape"/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
<SeriesItems>
<Series id="0" markerShape="MS_NONE" lineWidth="1" color="#FFFFFF"/>
</SeriesItems>
</Graph>
-->
</rw:graph>