我最近在开发中遇到一个问题,就是不知道怎么 消除重复的XML标记
hi saucer.我最近在开发中遇到一个问题,就是不知道怎么消除重复的XML标记,
for example:
<?xml version= "1.0 " encoding= "utf-16 "?> <man> <name> Raymond </name> Raymond <hair x= "0 " y= "0 " layer= "6 "> <style id= "1 " name= "1.png " path= "\content\wardrobe\Library\Raymond\hair\1.png " /> </hair> </man> <man> <name> Raymond </name> <hair x= "0 " y= "0 " layer= "6 "> <style id= "2 " name= "10.png " path= "\content\wardrobe\Library\Raymond\hair\10.png " /> </hair> </man>
template.xsl file
<?xml version= "1.0 " encoding= "utf-8 " ?>
<xsl:stylesheet xmlns:xsl= "http://www.w3.org/1999/XSL/Transform " version= "1.0 ">
<xsl:template match= "/NewDataSet/Table ">
<man>
<name>
<xsl:value-of select= "rolename "/>
</name>
<xsl:apply-templates select= "rolename "/>
<hair>
<xsl:attribute name= "x ">
<xsl:value-of select= "hairx "/>
</xsl:attribute>
<xsl:attribute name= "y ">
<xsl:value-of select= "hairy "/>
</xsl:attribute>
<xsl:attribute name= "layer ">
<xsl:value-of select= "layer "/>
</xsl:attribute>
<style>
<xsl:attribute name= "id ">
<xsl:value-of select= "hair