我有这个 xml 数据
<XMLCreators>
<row>
<RateNumber>1</RateNumber>
<RateLetter>Null</RateLetter>
<AssessmentStreet>Abesinia Passage</AssessmentStreet>
<RateAccomDesc>Dwelling (Part Of)</RateAccomDesc>
</row>
<row>
<RateNumber>1a</RateNumber>
<RateLetter>Null</RateLetter>
<AssessmentStreet>Arena's Palace Lane</AssessmentStreet>
<RateAccomDesc>Edmund's Home</RateAccomDesc>
</row>
</XMLCreators>
我用这个 xsl 改变了它的输出元素
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes" method="xml"/>
<xsl:template match="/">
<Address> <xsl:apply-templates/> </Address>
</xsl:template>
<xsl:template match="/XMLCreators/row">
<Rowinfo> <xsl:apply-templates/> </Rowinfo>
</xsl:template>
<xsl:template match="/XMLCreators/row/RateNumber">
<Locator> <xsl:apply-templates/> </Locator>
</xsl:template>
<xsl:template match="/XMLCreators/row/AssessmentStreet">
<thoroughfare> <xsl:apply-templates/> </thoroughfare>
</xsl:template>
<xsl:template match="/XMLCreators/row/RateAccomDesc">
<LocatorName> <xsl:apply-templates/> </LocatorName>
</xsl:template>
</xsl:stylesheet>
并制作了这个
<?xml version="1.0" encoding="utf-8"?>
<Address>
<Rowinfo>
<Locator>1</Locator>
Null
<thoroughfare>Abesinia Passage</thoroughfare>
<LocatorName>Dwelling (Part Of)</LocatorName>
</Rowinfo>
<Rowinfo>
<Locator>1a</Locator>
Null
<thoroughfare>Arena's Palace Lane</thoroughfare>
<LocatorName>Edmund's Home</LocatorName>
</Rowinfo>
</Address>
我想向 rowinfo (locatordesignator) 添加一个新元素,并使用 (rateletter 和 RateAccomDesc) 的值的串联填充它。
拜托,我需要这方面的帮助。