R
Red
Hi,
Pretty new to XML, but I have adopted some reports through my job that
I need to work with. I've got some training lined up next month, but
until then I have a few modifications to existing XSL files that I
need to make pretty sharpish.
We have certain reports that contain grouping and sums in the output.
The existing XSL just reads out all rows to html tables. I would like
to make these easier to read by eliminating all duplicates within a
row. At the moment, I dont have the access to change the XML output,
just the XSL. I hope the following example explains it well enough.
Any questions, let me know.
Thanks,
Red.
== XML ===========================================
<?xml version="1.0"?>
<rs:data>
<z:row BRANCH='Birmingham' ACCOUNT_NO='1001001' STATUS='Open'
BALANCE='5380.04'/>
<z:row BRANCH='Birmingham' ACCOUNT_NO='1001002' STATUS='Open'
BALANCE='1281.12'/>
<z:row BRANCH='London' ACCOUNT_NO='1001003' STATUS='Closed'
BALANCE='1015.32'/>
<z:row BRANCH='London' ACCOUNT_NO='1001004' STATUS='Open'
BALANCE='9866.53'/>
<z:row BRANCH='London' ACCOUNT_NO='1001005' STATUS='Open'
BALANCE='1659.55'/>
<z:row BRANCH='Glasgow' ACCOUNT_NO='1001006' STATUS='Open'
BALANCE='6944.21'/>
</rs:data>
== Current XSL ====================================
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<xsl:template match="/">
<table>
<xsl:for-each select="//z:row">
<tr>
<td><xsl:value-of select="@BRANCH"/></td>
<td><xsl:value-of select="@ACCOUNT_NO"/></td>
<td><xsl:value-of select="@STATUS"/></td>
<td><xsl:value-of select="@BALANCE"/></td>
<tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
<!--end-->
== Current Output =================================
Birmingham 1001001 Open 5380.04
Birmingham 1001002 Open 1281.12
London 1001003 Closed 1015.32
London 1001004 Open 9866.53
London 1001005 Open 1659.55
Glasgow 1001006 Open 6944.21
== Required output ================================
Birmingham 1001001 Open 5380.04
1001002 Open 1281.12
London 1001003 Closed 1015.32
1001004 Open 9866.53
1001005 Open 1659.55
Glasgow 1001006 Open 6944.21
Pretty new to XML, but I have adopted some reports through my job that
I need to work with. I've got some training lined up next month, but
until then I have a few modifications to existing XSL files that I
need to make pretty sharpish.
We have certain reports that contain grouping and sums in the output.
The existing XSL just reads out all rows to html tables. I would like
to make these easier to read by eliminating all duplicates within a
row. At the moment, I dont have the access to change the XML output,
just the XSL. I hope the following example explains it well enough.
Any questions, let me know.
Thanks,
Red.
== XML ===========================================
<?xml version="1.0"?>
<rs:data>
<z:row BRANCH='Birmingham' ACCOUNT_NO='1001001' STATUS='Open'
BALANCE='5380.04'/>
<z:row BRANCH='Birmingham' ACCOUNT_NO='1001002' STATUS='Open'
BALANCE='1281.12'/>
<z:row BRANCH='London' ACCOUNT_NO='1001003' STATUS='Closed'
BALANCE='1015.32'/>
<z:row BRANCH='London' ACCOUNT_NO='1001004' STATUS='Open'
BALANCE='9866.53'/>
<z:row BRANCH='London' ACCOUNT_NO='1001005' STATUS='Open'
BALANCE='1659.55'/>
<z:row BRANCH='Glasgow' ACCOUNT_NO='1001006' STATUS='Open'
BALANCE='6944.21'/>
</rs:data>
== Current XSL ====================================
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<xsl:template match="/">
<table>
<xsl:for-each select="//z:row">
<tr>
<td><xsl:value-of select="@BRANCH"/></td>
<td><xsl:value-of select="@ACCOUNT_NO"/></td>
<td><xsl:value-of select="@STATUS"/></td>
<td><xsl:value-of select="@BALANCE"/></td>
<tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
<!--end-->
== Current Output =================================
Birmingham 1001001 Open 5380.04
Birmingham 1001002 Open 1281.12
London 1001003 Closed 1015.32
London 1001004 Open 9866.53
London 1001005 Open 1659.55
Glasgow 1001006 Open 6944.21
== Required output ================================
Birmingham 1001001 Open 5380.04
1001002 Open 1281.12
London 1001003 Closed 1015.32
1001004 Open 9866.53
1001005 Open 1659.55
Glasgow 1001006 Open 6944.21