开发者

Need to write a XSLT that will transform the XML in below format

Source XML :---I have multiple Owner with same and different value and has different contract number.

<?xml version="1.0" standalone="yes"?>
<NewDataSet>
  <Table1>
    <Owner>1</Owner>
       <Contract_Number>3</Contract_Number>
    </Table1>
  <Table1>
    <Owner>1</Owner>
        <Contract_Number>4</Contract_Number>
     </Table1>
  <Table1>
    <Owner>1</Owner>
        <Contract_Number>4</Contract_Number>
     </Table1>
</NewDataSet>

OUT XML Required using XSLT :-

<?xml version="1.0" standalone="yes"?>
       <NewDataSet>
      <Table1>
        <Owner>
           <Contract_Number>3</Contract_Number>
           <Contract_Number>4</Contract_Number>
           <Contract_Number>4</Contract_Number>
        </Owner>

      </Table1>
    </NewDataSet>开发者_如何学Python;

I need a XSLT for above out put.Any help will be highly appreciated.


It would probably help to have the actual xml file rather than a string of numbers.

Wonderful

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/">
<NewDataSet>
<Table1>
<Owner>
<xsl:for-each select="NewDataSet/Table1">
<Contract_Number><xsl:value-of select="Contract_Number"/></Contract_Number>
      </xsl:for-each>
</Owner>
</Table1>
</NewDataSet>
</xsl:template>
</xsl:stylesheet>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜