H
Hyunchan Kim
To indent xml file, I made an instance of Transformer from Templates
using following.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xslt"
version="1.0">
<xslutput method="xml" indent="yes" xalan:indent-amount="4"/>
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
The transform seems to work fine, most of the cases. But if I call
transform above XML as an input, output has only one xmlns attribute
like this.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xalan="http://xml.apache.org/xslt"
version="1.0">
<xslutput method="xml" indent="yes" xalan:indent-amount="4"/>
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
Following attribute is lost...
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
If I modify "xmlns:xsl" to "mlns:xsl" (delete first character to see
what happens), output is correct i.e, root element has two attributes
including
mlns:xsl="http://www.w3.org/1999/XSL/Transform"
I have read some reference materials to find out what's wrong. But I
can't find any problem.
As I know so far, <xsl:template match="/"> means root of DOM tree and
<xsl:copy-of select="."/> means copy that to target document.
So, I think everything should go fine...
Does anyone know what's wrong?
using following.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xslt"
version="1.0">
<xslutput method="xml" indent="yes" xalan:indent-amount="4"/>
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
The transform seems to work fine, most of the cases. But if I call
transform above XML as an input, output has only one xmlns attribute
like this.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xalan="http://xml.apache.org/xslt"
version="1.0">
<xslutput method="xml" indent="yes" xalan:indent-amount="4"/>
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
Following attribute is lost...
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
If I modify "xmlns:xsl" to "mlns:xsl" (delete first character to see
what happens), output is correct i.e, root element has two attributes
including
mlns:xsl="http://www.w3.org/1999/XSL/Transform"
I have read some reference materials to find out what's wrong. But I
can't find any problem.
As I know so far, <xsl:template match="/"> means root of DOM tree and
<xsl:copy-of select="."/> means copy that to target document.
So, I think everything should go fine...
Does anyone know what's wrong?