开发者

HELP with XML to XML transformation using XSLT

开发者 https://www.devze.com 2023-01-04 00:31 出处:网络
Am a rookie trying XSLT and XML tranformations for the first time. To start off, i tried a simple sample programs.

Am a rookie trying XSLT and XML tranformations for the first time. To start off, i tried a simple sample programs.

I expected the Output in Tree format (maintaining the hierarchy) instead i just get " KING" in single line...

What开发者_JAVA百科 could be the problem? PS: I use XMLSpy.

Any guideline would be great full. Thanks :)

Input XML:

<ROWSET>
    <ROW>
        <EMPNO>7839</EMPNO>
        <ENAME>KING</ENAME>
    </ROW>
</ROWSET>

XSL used for transformation:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="no"/>
<xsl:template match="/">
    <Invitation>
        <To>
            <xsl:value-of select="ROWSET/ROW/ENAME"/>
        </To>
    </Invitation>
</xsl:template>


Well, the only thing that I see is that you miss the closing element </xsl:stylesheet> in the XSL. Other than that, I think the XSL is OK, and if I use it (from Java code) I get <Invitation><To>KING</To></Invitation>, which is, I presume, what you expect.

0

精彩评论

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