如何将此xml转置为行而不是列 [英] How to transpose this xml to look like rows and not columns
问题描述
如何将此xml转置为行似乎如下所示:
How to transpose this xml to look like rows
Now its like below:
product stock-description
NOKN95ST Nokia N95 3G Handset
现在我想要:
Now i want:
Product: NOKN95ST
stock-desrip: Nokia N95 3G HandSet
左下面的样品xml: - < outright>
< product> NOKN95ST< / product>
< stock-description> Nokia N95 3G Handset< / stock-description>
< stock-desc2> 5兆像素相机,内置< / stock-desc2>
< stock-desc3> GPS,MP3,蓝牙< / stock-desc3>
< qty> 1< / qty>
< out-serial> 346516325422222< / out-serial>
< unit -Price> 789.00< / unit-price>
< discount> 0.00< / discount>
< line-amt-ex-gst> 717.27< / line-amt-ex-gst>
< line-gst-amt> 71.73< / line-gst-amt>
< line-amt-inc-gst> 789.00< / line-amt-inc-gst>
< item-cost> 567.00< / item-cost>
< line-cost> 567.00< / line-cost>
< gp> 222.00< / gp>
< / outright>
提前谢谢
sample xml below:-
<outright>
<product>NOKN95ST </product>
<stock-description>Nokia N95 3G Handset </stock-description>
<stock-desc2>5 Mega Pixel Camera, Inbuilt </stock-desc2>
<stock-desc3>GPS, MP3, Bluetooth </stock-desc3>
<qty>1</qty>
<out-serial>346516325422222 </out-serial>
<unit-price> 789.00</unit-price>
<discount> 0.00</discount>
<line-amt-ex-gst> 717.27</line-amt-ex-gst>
<line-gst-amt> 71.73</line-gst-amt>
<line-amt-inc-gst> 789.00</line-amt-inc-gst>
<item-cost> 567.00</item-cost>
<line-cost> 567.00</line-cost>
<gp> 222.00</gp>
</outright>
THanks in Advance
推荐答案
尝试下面的XSLT :
Try the below XSLT:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/outright">
Product: <xsl:value-of select="product"/>
stock-desrip: <xsl:value-of select="stock-description"/>
</xsl:template>
</xsl:stylesheet>
这篇关于如何将此xml转置为行而不是列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!