XSLT 将 2 个节点集转换为行和列
我是 XML 和 XML 的新手。 XSLT却遇到了这个问题。 我有以下 XML 文件格式:-
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="testing.xsl"?>
<asx:ABAP xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:VALUES>
<SOURCE>
<AXIS_INFO>
<RRWS_SX_AXIS_INFO>
<AXIS>000</AXIS>
<NCHARS>1</NCHARS>
<NCOORDS>3</NCOORDS>
<CHARS>
<RRWS_SX_AXIS_CHARS>
<CHANM>49E9DSTKHGHIYTUZRJ1XKDLC6</CHANM>
<HIENM />
<VERSION />
<DATETO>0000-00-00</DATETO>
<CAPTION>Key Figures</CAPTION>
<CHAPRSNT>1</CHAPRSNT>
<CHATYP>0</CHATYP>
<ATTRINM />
</RRWS_SX_AXIS_CHARS>
</CHARS>
</RRWS_SX_AXIS_INFO>
<RRWS_SX_AXIS_INFO>
<AXIS>001</AXIS>
<NCHARS>3</NCHARS>
<NCOORDS>370</NCOORDS>
<CHARS>
<RRWS_SX_AXIS_CHARS>
<CHANM>0IS_CSTATUS</CHANM>
<HIENM />
<VERSION />
<DATETO>0000-00-00</DATETO>
<CAPTION>Claim Status</CAPTION>
<CHAPRSNT>1</CHAPRSNT>
<CHATYP>1</CHATYP>
<ATTRINM />
</RRWS_SX_AXIS_CHARS>
<RRWS_SX_AXIS_CHARS>
<CHANM>INJDESCRP</CHANM>
<HIENM />
<VERSION />
<DATETO>0000-00-00</DATETO>
<CAPTION>Injury Descriptor</CAPTION>
<CHAPRSNT>1</CHAPRSNT>
<CHATYP>1</CHATYP>
<ATTRINM />
</RRWS_SX_AXIS_CHARS>
<RRWS_SX_AXIS_CHARS>
<CHANM>0IS_CLAIMNT</CHANM>
<HIENM />
<VERSION />
<DATETO>0000-00-00</DATETO>
<CAPTION>Claimant</CAPTION>
<CHAPRSNT>1</CHAPRSNT>
<CHATYP>1</CHATYP>
<ATTRINM>
<RRWS_S_ATTRINM>
<ATTRINM>ZIPCD1ST</ATTRINM>
<CAPTION>Post Code 1st part.</CAPTION>
<CHAPRSNT>2</CHAPRSNT>
</RRWS_S_ATTRINM>
</ATTRINM>
</RRWS_SX_AXIS_CHARS>
</CHARS>
</RRWS_SX_AXIS_INFO>
</AXIS_INFO>
<CELL_DATA>
<RRWS_S_CELL>
<CELL_ORDINAL>000000</CELL_ORDINAL>
<VALUE>1.00000000000000</VALUE>
<FORMATTED_VALUE>1</FORMATTED_VALUE>
<VALUE_TYPE />
<CURRENCY />
<UNIT />
<MWKZ>F</MWKZ>
<NUM_SCALE>0</NUM_SCALE>
<NUM_PREC>0</NUM_PREC>
<CELL_STATUS />
<BACK_COLOR>00</BACK_COLOR>
</RRWS_S_CELL>
<RRWS_S_CELL>
<CELL_ORDINAL>000001</CELL_ORDINAL>
<VALUE>12131.80</VALUE>
<FORMATTED_VALUE>£ 12,131.80</FORMATTED_VALUE>
<VALUE_TYPE />
<CURRENCY>GBP</CURRENCY>
<UNIT />
<MWKZ>W</MWKZ>
<NUM_SCALE>0</NUM_SCALE>
<NUM_PREC>0</NUM_PREC>
<CELL_STATUS />
<BACK_COLOR>00</BACK_COLOR>
</RRWS_S_CELL>
<RRWS_S_CELL>
<CELL_ORDINAL>000002</CELL_ORDINAL>
<VALUE>10131.80</VALUE>
<FORMATTED_VALUE>£ 10,131.80</FORMATTED_VALUE>
<VALUE_TYPE />
<CURRENCY>GBP</CURRENCY>
<UNIT />
<MWKZ>W</MWKZ>
<NUM_SCALE>0</NUM_SCALE>
<NUM_PREC>0</NUM_PREC>
<CELL_STATUS />
<BACK_COLOR>00</BACK_COLOR>
</RRWS_S_CELL>
<RRWS_S_CELL>
<CELL_ORDINAL>000003</CELL_ORDINAL>
<VALUE>1.00000000000000</VALUE>
<FORMATTED_VALUE>1</FORMATTED_VALUE>
<VALUE_TYPE />
<CURRENCY />
<UNIT />
<MWKZ>F</MWKZ>
<NUM_SCALE>0</NUM_SCALE>
<NUM_PREC>0</NUM_PREC>
<CELL_STATUS />
<BACK_COLOR>00</BACK_COLOR>
</RRWS_S_CELL>
<RRWS_S_CELL>
<CELL_ORDINAL>000004</CELL_ORDINAL>
<VALUE>28116.90</VALUE>
<FORMATTED_VALUE>£ 28,116.90</FORMATTED_VALUE>
<VALUE_TYPE />
<CURRENCY>GBP</CURRENCY>
<UNIT />
<MWKZ>W</MWKZ>
<NUM_SCALE>0</NUM_SCALE>
<NUM_PREC>0</NUM_PREC>
<CELL_STATUS />
<BACK_COLOR>00</BACK_COLOR>
</RRWS_S_CELL>
<RRWS_S_CELL>
<CELL_ORDINAL>000005</CELL_ORDINAL>
<VALUE>7616.90</VALUE>
<FORMATTED_VALUE>£ 7,616.90</FORMATTED_VALUE>
<VALUE_TYPE />
<CURRENCY>GBP</CURRENCY>
<UNIT />
<MWKZ>W</MWKZ>
<NUM_SCALE>0</NUM_SCALE>
<NUM_PREC>0</NUM_PREC>
<CELL_STATUS />
<BACK_COLOR>00</BACK_COLOR>
</RRWS_S_CELL>
</CELL_DATA>
<AXIS_DATA>
<RRWS_SX_AXIS_DATA>
<AXIS>000</AXIS>
<SET>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000000</TUPLE_ORDINAL>
<CHANM>49E9DSTKHGHIYTUZRJ1XKDLC6</CHANM>
<CAPTION>Count of Unique Claim Numbers</CAPTION>
<CHAVL>49E9DT190F38HGEFXD49UFK1Y</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES />
</RRWS_SX_TUPLE>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000001</TUPLE_ORDINAL>
<CHANM>49E9DSTKHGHIYTUZRJ1XKDLC6</CHANM>
<CAPTION>Current reserve</CAPTION>
<CHAVL>49E9DT8XJDOY02XW376M4HIRQ</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES />
</RRWS_SX_TUPLE>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000002</TUPLE_ORDINAL>
<CHANM>49E9DSTKHGHIYTUZRJ1XKDLC6</CHANM>
<CAPTION>Payment Amount Posted in CM</CAPTION>
<CHAVL>49E9DTGM2CANIPHC918YEJHHI</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES />
</RRWS_SX_TUPLE>
</SET>
</RRWS_SX_AXIS_DATA>
<RRWS_SX_AXIS_DATA>
<AXIS>001</AXIS>
<SET>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000000</TUPLE_ORDINAL>
<CHANM>0IS_CSTATUS</CHANM>
<CAPTION>Reopened</CAPTION>
<CHAVL>1</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES />
</RRWS_SX_TUPLE>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000000</TUPLE_ORDINAL>
<CHANM>INJDESCRP</CHANM>
<CAPTION>Disease</CAPTION>
<CHAVL>ZDI</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES />
</RRWS_SX_TUPLE>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000000</TUPLE_ORDINAL>
<CHANM>0IS_CLAIMNT</CHANM>
<CAPTION>Whithead</CAPTION>
<CHAVL>0103619133</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES>
<RRWS_S_ATTRIBUTES>
<ATTRINM>ZIPCD1ST</ATTRINM>
<CAPTION />
<ATTRIVL>L24</ATTRIVL>
</RRWS_S_ATTRIBUTES>
</ATTRIBUTES>
</RRWS_SX_TUPLE>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000001</TUPLE_ORDINAL>
<CHANM>0IS_CSTATUS</CHANM>
<CAPTION>Reopened</CAPTION>
<CHAVL>1</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES />
</RRWS_SX_TUPLE>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000001</TUPLE_ORDINAL>
<CHANM>INJDESCRP</CHANM>
<CAPTION>Disease</CAPTION>
<CHAVL>ZDI</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES />
</RRWS_SX_TUPLE>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000001</TUPLE_ORDINAL>
<CHANM>0IS_CLAIMNT</CHANM>
<CAPTION>Smellie</CAPTION>
<CHAVL>0103630524</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES>
<RRWS_S_ATTRIBUTES>
<ATTRINM>ZIPCD1ST</ATTRINM>
<CAPTION />
<ATTRIVL>M21</ATTRIVL>
</RRWS_S_ATTRIBUTES>
</ATTRIBUTES>
</RRWS_SX_TUPLE>
</SET>
</RRWS_SX_AXIS_DATA>
<RRWS_SX_AXIS_DATA />
</AXIS_DATA>
</SOURCE>
</asx:VALUES>
</asx:ABAP>
我想做的是产生这样的结果:-
L24 Reopened Disease Whithead 1 £ 12,131.80 £ 10,131.80
M21 Reopened Disease Smellie 1 £ 28,116.90 £ 7,616.90
我已经利用了这里的样式表 http://forums.asp.net/p/1449946/3309441.aspx 但我只能让它产生这 :-
Reopened Disease Whithead L24
Reopened Disease Smellie M21
这是迄今为止我的样式表 :-
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="col-count" select="3"/>
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html lang="en">
<head>
<title>Example</title>
</head>
<body>
<table border="1">
<tbody>
<tr bgcolor="#9acd32">
<th>Claim Status</th>
<th>Injury Desc</th>
<th>Claimant</th>
</tr>
<xsl:apply-templates select="//AXIS_DATA/RRWS_SX_AXIS_DATA[2]/SET/RRWS_SX_TUPLE[position() mod $col-count = 1]" mode="row"/>
</tbody>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="RRWS_SX_TUPLE" mode="row">
<tr>
<xsl:apply-templates select=". | following-sibling::RRWS_SX_TUPLE[position() < $col-count]" mode="cell"/>
</tr>
</xsl:template>
<xsl:template match="RRWS_SX_TUPLE" mode="cell">
<td><xsl:value-of select="CAPTION"/></td>
<td><xsl:value-of select="ATTRIBUTES/RRWS_S_ATTRIBUTES/ATTRIVL"/></td>
</xsl:template>
</xsl:stylesheet>
XML 文件非常复杂,我在这里只展示了一些内容来展示我正在尝试做什么。
最终,一旦我完成了这项工作,我的想法就是将 XML 文件转换为另一个具有简单结构的 XML 文件:-
<data>
<variable name="cc">
<row>
<column>L24</column>
<column>Reopened</column>
<column>Disease</column>
<column>Whithead</column>
<column>1</column>
<column>12,131.80</column>
<column>10,131.80</column>
</row>
<row>
<column>M21</column>
<column>Reopened</column>
<column>Disease</column>
<column>Smellie</column>
<column>1</column>
<column>28,116.90</column>
<column>7,616.90</column>
</row>
</varible>
</data>
有人能给我指出正确的方向吗?或者更好的是仍然为我提供必要的代码?
I am new to XML & XSLT but have got this problem.
I have the following XML file format :-
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="testing.xsl"?>
<asx:ABAP xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:VALUES>
<SOURCE>
<AXIS_INFO>
<RRWS_SX_AXIS_INFO>
<AXIS>000</AXIS>
<NCHARS>1</NCHARS>
<NCOORDS>3</NCOORDS>
<CHARS>
<RRWS_SX_AXIS_CHARS>
<CHANM>49E9DSTKHGHIYTUZRJ1XKDLC6</CHANM>
<HIENM />
<VERSION />
<DATETO>0000-00-00</DATETO>
<CAPTION>Key Figures</CAPTION>
<CHAPRSNT>1</CHAPRSNT>
<CHATYP>0</CHATYP>
<ATTRINM />
</RRWS_SX_AXIS_CHARS>
</CHARS>
</RRWS_SX_AXIS_INFO>
<RRWS_SX_AXIS_INFO>
<AXIS>001</AXIS>
<NCHARS>3</NCHARS>
<NCOORDS>370</NCOORDS>
<CHARS>
<RRWS_SX_AXIS_CHARS>
<CHANM>0IS_CSTATUS</CHANM>
<HIENM />
<VERSION />
<DATETO>0000-00-00</DATETO>
<CAPTION>Claim Status</CAPTION>
<CHAPRSNT>1</CHAPRSNT>
<CHATYP>1</CHATYP>
<ATTRINM />
</RRWS_SX_AXIS_CHARS>
<RRWS_SX_AXIS_CHARS>
<CHANM>INJDESCRP</CHANM>
<HIENM />
<VERSION />
<DATETO>0000-00-00</DATETO>
<CAPTION>Injury Descriptor</CAPTION>
<CHAPRSNT>1</CHAPRSNT>
<CHATYP>1</CHATYP>
<ATTRINM />
</RRWS_SX_AXIS_CHARS>
<RRWS_SX_AXIS_CHARS>
<CHANM>0IS_CLAIMNT</CHANM>
<HIENM />
<VERSION />
<DATETO>0000-00-00</DATETO>
<CAPTION>Claimant</CAPTION>
<CHAPRSNT>1</CHAPRSNT>
<CHATYP>1</CHATYP>
<ATTRINM>
<RRWS_S_ATTRINM>
<ATTRINM>ZIPCD1ST</ATTRINM>
<CAPTION>Post Code 1st part.</CAPTION>
<CHAPRSNT>2</CHAPRSNT>
</RRWS_S_ATTRINM>
</ATTRINM>
</RRWS_SX_AXIS_CHARS>
</CHARS>
</RRWS_SX_AXIS_INFO>
</AXIS_INFO>
<CELL_DATA>
<RRWS_S_CELL>
<CELL_ORDINAL>000000</CELL_ORDINAL>
<VALUE>1.00000000000000</VALUE>
<FORMATTED_VALUE>1</FORMATTED_VALUE>
<VALUE_TYPE />
<CURRENCY />
<UNIT />
<MWKZ>F</MWKZ>
<NUM_SCALE>0</NUM_SCALE>
<NUM_PREC>0</NUM_PREC>
<CELL_STATUS />
<BACK_COLOR>00</BACK_COLOR>
</RRWS_S_CELL>
<RRWS_S_CELL>
<CELL_ORDINAL>000001</CELL_ORDINAL>
<VALUE>12131.80</VALUE>
<FORMATTED_VALUE>£ 12,131.80</FORMATTED_VALUE>
<VALUE_TYPE />
<CURRENCY>GBP</CURRENCY>
<UNIT />
<MWKZ>W</MWKZ>
<NUM_SCALE>0</NUM_SCALE>
<NUM_PREC>0</NUM_PREC>
<CELL_STATUS />
<BACK_COLOR>00</BACK_COLOR>
</RRWS_S_CELL>
<RRWS_S_CELL>
<CELL_ORDINAL>000002</CELL_ORDINAL>
<VALUE>10131.80</VALUE>
<FORMATTED_VALUE>£ 10,131.80</FORMATTED_VALUE>
<VALUE_TYPE />
<CURRENCY>GBP</CURRENCY>
<UNIT />
<MWKZ>W</MWKZ>
<NUM_SCALE>0</NUM_SCALE>
<NUM_PREC>0</NUM_PREC>
<CELL_STATUS />
<BACK_COLOR>00</BACK_COLOR>
</RRWS_S_CELL>
<RRWS_S_CELL>
<CELL_ORDINAL>000003</CELL_ORDINAL>
<VALUE>1.00000000000000</VALUE>
<FORMATTED_VALUE>1</FORMATTED_VALUE>
<VALUE_TYPE />
<CURRENCY />
<UNIT />
<MWKZ>F</MWKZ>
<NUM_SCALE>0</NUM_SCALE>
<NUM_PREC>0</NUM_PREC>
<CELL_STATUS />
<BACK_COLOR>00</BACK_COLOR>
</RRWS_S_CELL>
<RRWS_S_CELL>
<CELL_ORDINAL>000004</CELL_ORDINAL>
<VALUE>28116.90</VALUE>
<FORMATTED_VALUE>£ 28,116.90</FORMATTED_VALUE>
<VALUE_TYPE />
<CURRENCY>GBP</CURRENCY>
<UNIT />
<MWKZ>W</MWKZ>
<NUM_SCALE>0</NUM_SCALE>
<NUM_PREC>0</NUM_PREC>
<CELL_STATUS />
<BACK_COLOR>00</BACK_COLOR>
</RRWS_S_CELL>
<RRWS_S_CELL>
<CELL_ORDINAL>000005</CELL_ORDINAL>
<VALUE>7616.90</VALUE>
<FORMATTED_VALUE>£ 7,616.90</FORMATTED_VALUE>
<VALUE_TYPE />
<CURRENCY>GBP</CURRENCY>
<UNIT />
<MWKZ>W</MWKZ>
<NUM_SCALE>0</NUM_SCALE>
<NUM_PREC>0</NUM_PREC>
<CELL_STATUS />
<BACK_COLOR>00</BACK_COLOR>
</RRWS_S_CELL>
</CELL_DATA>
<AXIS_DATA>
<RRWS_SX_AXIS_DATA>
<AXIS>000</AXIS>
<SET>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000000</TUPLE_ORDINAL>
<CHANM>49E9DSTKHGHIYTUZRJ1XKDLC6</CHANM>
<CAPTION>Count of Unique Claim Numbers</CAPTION>
<CHAVL>49E9DT190F38HGEFXD49UFK1Y</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES />
</RRWS_SX_TUPLE>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000001</TUPLE_ORDINAL>
<CHANM>49E9DSTKHGHIYTUZRJ1XKDLC6</CHANM>
<CAPTION>Current reserve</CAPTION>
<CHAVL>49E9DT8XJDOY02XW376M4HIRQ</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES />
</RRWS_SX_TUPLE>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000002</TUPLE_ORDINAL>
<CHANM>49E9DSTKHGHIYTUZRJ1XKDLC6</CHANM>
<CAPTION>Payment Amount Posted in CM</CAPTION>
<CHAVL>49E9DTGM2CANIPHC918YEJHHI</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES />
</RRWS_SX_TUPLE>
</SET>
</RRWS_SX_AXIS_DATA>
<RRWS_SX_AXIS_DATA>
<AXIS>001</AXIS>
<SET>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000000</TUPLE_ORDINAL>
<CHANM>0IS_CSTATUS</CHANM>
<CAPTION>Reopened</CAPTION>
<CHAVL>1</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES />
</RRWS_SX_TUPLE>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000000</TUPLE_ORDINAL>
<CHANM>INJDESCRP</CHANM>
<CAPTION>Disease</CAPTION>
<CHAVL>ZDI</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES />
</RRWS_SX_TUPLE>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000000</TUPLE_ORDINAL>
<CHANM>0IS_CLAIMNT</CHANM>
<CAPTION>Whithead</CAPTION>
<CHAVL>0103619133</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES>
<RRWS_S_ATTRIBUTES>
<ATTRINM>ZIPCD1ST</ATTRINM>
<CAPTION />
<ATTRIVL>L24</ATTRIVL>
</RRWS_S_ATTRIBUTES>
</ATTRIBUTES>
</RRWS_SX_TUPLE>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000001</TUPLE_ORDINAL>
<CHANM>0IS_CSTATUS</CHANM>
<CAPTION>Reopened</CAPTION>
<CHAVL>1</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES />
</RRWS_SX_TUPLE>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000001</TUPLE_ORDINAL>
<CHANM>INJDESCRP</CHANM>
<CAPTION>Disease</CAPTION>
<CHAVL>ZDI</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES />
</RRWS_SX_TUPLE>
<RRWS_SX_TUPLE>
<TUPLE_ORDINAL>000001</TUPLE_ORDINAL>
<CHANM>0IS_CLAIMNT</CHANM>
<CAPTION>Smellie</CAPTION>
<CHAVL>0103630524</CHAVL>
<CHAVL_EXT />
<NIOBJNM />
<TLEVEL>00</TLEVEL>
<DRILLSTATE />
<OPT />
<SIGN />
<ATTRIBUTES>
<RRWS_S_ATTRIBUTES>
<ATTRINM>ZIPCD1ST</ATTRINM>
<CAPTION />
<ATTRIVL>M21</ATTRIVL>
</RRWS_S_ATTRIBUTES>
</ATTRIBUTES>
</RRWS_SX_TUPLE>
</SET>
</RRWS_SX_AXIS_DATA>
<RRWS_SX_AXIS_DATA />
</AXIS_DATA>
</SOURCE>
</asx:VALUES>
</asx:ABAP>
What I am trying to do is produce the results like this :-
L24 Reopened Disease Whithead 1 £ 12,131.80 £ 10,131.80
M21 Reopened Disease Smellie 1 £ 28,116.90 £ 7,616.90
I have utilised the style sheet from here http://forums.asp.net/p/1449946/3309441.aspx but I can only get it to produce this :-
Reopened Disease Whithead L24
Reopened Disease Smellie M21
This is my style sheet thus far :-
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="col-count" select="3"/>
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html lang="en">
<head>
<title>Example</title>
</head>
<body>
<table border="1">
<tbody>
<tr bgcolor="#9acd32">
<th>Claim Status</th>
<th>Injury Desc</th>
<th>Claimant</th>
</tr>
<xsl:apply-templates select="//AXIS_DATA/RRWS_SX_AXIS_DATA[2]/SET/RRWS_SX_TUPLE[position() mod $col-count = 1]" mode="row"/>
</tbody>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="RRWS_SX_TUPLE" mode="row">
<tr>
<xsl:apply-templates select=". | following-sibling::RRWS_SX_TUPLE[position() < $col-count]" mode="cell"/>
</tr>
</xsl:template>
<xsl:template match="RRWS_SX_TUPLE" mode="cell">
<td><xsl:value-of select="CAPTION"/></td>
<td><xsl:value-of select="ATTRIBUTES/RRWS_S_ATTRIBUTES/ATTRIVL"/></td>
</xsl:template>
</xsl:stylesheet>
The XML file is quite complex I have only shown a little here to show what it is I am trying to do.
Ultimately once I have this working the idea is to convert the XML file into another XML file that has a simple structure :-
<data>
<variable name="cc">
<row>
<column>L24</column>
<column>Reopened</column>
<column>Disease</column>
<column>Whithead</column>
<column>1</column>
<column>12,131.80</column>
<column>10,131.80</column>
</row>
<row>
<column>M21</column>
<column>Reopened</column>
<column>Disease</column>
<column>Smellie</column>
<column>1</column>
<column>28,116.90</column>
<column>7,616.90</column>
</row>
</varible>
</data>
Can someone point me in the right direction please or better still provide me with the necessary code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此样式表:
当应用于已发布的文档时,会生成以下输出(根据要求):
This stylesheet:
when applied to the posted document, produces this output (as requested):