您的输出与输入不匹配。没有
Data Processing Manager
在输入中的位置。
假设给定输入示例所需的输出实际上是:
后果
PositionIdentifier,Position Name,Grade Name,Vacant Positions
1541,Test Benefits Clerk,G,VACANT1
1122,Test Clerk Typist,G,VACANT1
1122,Test Clerk Typist,G,VACANT2
1513,Test Human Resources Specialist I,G,VACANT1
1514,Test Human Resources Specialist II,G,VACANT1
1332,Test Computer Programmer II,G,VACANT1
1352,Test Systems Project Leader,M,VACANT1
1352,Test Systems Project Leader,M,VACANT2
1371,Test Technical Support Specialist I,G,VACANT1
1371,Test Technical Support Specialist I,G,VACANT2
3518,Test Water Maintenance Technician,G,VACANT1
3518,Test Water Maintenance Technician,G,VACANT2
3518,Test Water Maintenance Technician,G,VACANT3
3518,Test Water Maintenance Technician,G,VACANT4
3518,Test Water Maintenance Technician,G,VACANT5
3518,Test Water Maintenance Technician,G,VACANT6
3518,Test Water Maintenance Technician,G,VACANT7
3518,Test Water Maintenance Technician,G,VACANT8
3518,Test Water Maintenance Technician,G,VACANT9
3518,Test Water Maintenance Technician,G,VACANT10
3518,Test Water Maintenance Technician,G,VACANT11
3518,Test Water Maintenance Technician,G,VACANT12
3518,Test Water Maintenance Technician,G,VACANT13
3518,Test Water Maintenance Technician,G,VACANT14
3518,Test Water Maintenance Technician,G,VACANT15
3518,Test Water Maintenance Technician,G,VACANT16
3518,Test Water Maintenance Technician,G,VACANT17
3518,Test Water Maintenance Technician,G,VACANT18
3518,Test Water Maintenance Technician,G,VACANT19
3518,Test Water Maintenance Technician,G,VACANT20
3518,Test Water Maintenance Technician,G,VACANT21
3518,Test Water Maintenance Technician,G,VACANT22
3518,Test Water Maintenance Technician,G,VACANT23
3518,Test Water Maintenance Technician,G,VACANT24
3518,Test Water Maintenance Technician,G,VACANT25
3518,Test Water Maintenance Technician,G,VACANT26
3518,Test Water Maintenance Technician,G,VACANT27
3518,Test Water Maintenance Technician,G,VACANT28
3518,Test Water Maintenance Technician,G,VACANT29
3518,Test Water Maintenance Technician,G,VACANT30
3518,Test Water Maintenance Technician,G,VACANT31
3518,Test Water Maintenance Technician,G,VACANT32
3518,Test Water Maintenance Technician,G,VACANT33
3518,Test Water Maintenance Technician,G,VACANT34
3518,Test Water Maintenance Technician,G,VACANT35
3518,Test Water Maintenance Technician,G,VACANT36
3518,Test Water Maintenance Technician,G,VACANT37
3518,Test Water Maintenance Technician,G,VACANT38
3518,Test Water Maintenance Technician,G,VACANT39
3518,Test Water Maintenance Technician,G,VACANT40
3518,Test Water Maintenance Technician,G,VACANT41
3518,Test Water Maintenance Technician,G,VACANT42
3518,Test Water Maintenance Technician,G,VACANT43
3518,Test Water Maintenance Technician,G,VACANT44
3518,Test Water Maintenance Technician,G,VACANT45
3518,Test Water Maintenance Technician,G,VACANT46
3518,Test Water Maintenance Technician,G,VACANT47
3518,Test Water Maintenance Technician,G,VACANT48
3518,Test Water Maintenance Technician,G,VACANT49
3518,Test Water Maintenance Technician,G,VACANT50
3518,Test Water Maintenance Technician,G,VACANT51
3518,Test Water Maintenance Technician,G,VACANT52
3518,Test Water Maintenance Technician,G,VACANT53
3518,Test Water Maintenance Technician,G,VACANT54
3518,Test Water Maintenance Technician,G,VACANT55
3518,Test Water Maintenance Technician,G,VACANT56
3518,Test Water Maintenance Technician,G,VACANT57
3518,Test Water Maintenance Technician,G,VACANT58
3518,Test Water Maintenance Technician,G,VACANT59
3518,Test Water Maintenance Technician,G,VACANT60
3518,Test Water Maintenance Technician,G,VACANT61
3518,Test Water Maintenance Technician,G,VACANT62
3518,Test Water Maintenance Technician,G,VACANT63
3518,Test Water Maintenance Technician,G,VACANT64
3518,Test Water Maintenance Technician,G,VACANT65
3518,Test Water Maintenance Technician,G,VACANT66
3518,Test Water Maintenance Technician,G,VACANT67
3518,Test Water Maintenance Technician,G,VACANT68
3518,Test Water Maintenance Technician,G,VACANT69
3518,Test Water Maintenance Technician,G,VACANT70
3518,Test Water Maintenance Technician,G,VACANT71
3518,Test Water Maintenance Technician,G,VACANT72
3518,Test Water Maintenance Technician,G,VACANT73
1116,Test Customer Service Rep I,G,VACANT1
1116,Test Customer Service Rep I,G,VACANT2
1116,Test Customer Service Rep I,G,VACANT3
1116,Test Customer Service Rep I,G,VACANT4
1116,Test Customer Service Rep I,G,VACANT5
1116,Test Customer Service Rep I,G,VACANT6
1116,Test Customer Service Rep I,G,VACANT7
1116,Test Customer Service Rep I,G,VACANT8
1116,Test Customer Service Rep I,G,VACANT9
1116,Test Customer Service Rep I,G,VACANT10
1116,Test Customer Service Rep I,G,VACANT11
1116,Test Customer Service Rep I,G,VACANT12
1116,Test Customer Service Rep I,G,VACANT13
1116,Test Customer Service Rep I,G,VACANT14
1142,Test Account Clerk II,G,VACANT1
1142,Test Account Clerk II,G,VACANT2
4241,Test Civil Engineer I,G,VACANT1
3517,Test Water Maintenance Foreman,G,VACANT1
3517,Test Water Maintenance Foreman,G,VACANT2
3517,Test Water Maintenance Foreman,G,VACANT3
3517,Test Water Maintenance Foreman,G,VACANT4
3517,Test Water Maintenance Foreman,G,VACANT5
3517,Test Water Maintenance Foreman,G,VACANT6
3517,Test Water Maintenance Foreman,G,VACANT7
3517,Test Water Maintenance Foreman,G,VACANT8
3517,Test Water Maintenance Foreman,G,VACANT9
3517,Test Water Maintenance Foreman,G,VACANT10
3517,Test Water Maintenance Foreman,G,VACANT11
3517,Test Water Maintenance Foreman,G,VACANT12
3517,Test Water Maintenance Foreman,G,VACANT13
3517,Test Water Maintenance Foreman,G,VACANT14
3517,Test Water Maintenance Foreman,G,VACANT15
3517,Test Water Maintenance Foreman,G,VACANT16
3517,Test Water Maintenance Foreman,G,VACANT17
3517,Test Water Maintenance Foreman,G,VACANT18
3517,Test Water Maintenance Foreman,G,VACANT19
3517,Test Water Maintenance Foreman,G,VACANT20
可使用以下方法生产:
XSLT 2.0
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template match="/DATA_DS">
<!-- header -->
<xsl:text>PositionIdentifier,Position Name,Grade Name,Vacant Positions
</xsl:text>
<!-- data -->
<xsl:for-each select="G_1">
<xsl:variable name="common-data">
<xsl:value-of select="POSITIONID"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="normalize-space(POSITION_NAME)"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="GRADE_NAME"/>
<xsl:text>,</xsl:text>
</xsl:variable>
<xsl:for-each select="1 to VACANT_POSITIONS">
<xsl:copy-of select="$common-data"/>
<xsl:text>VACANT</xsl:text>
<xsl:value-of select="."/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>