Please try this XSL..
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
</xsl:copy>
</xsl:template>
<xsl:template match="@*[name() =
'xsi:schemaLocation']">
<xsl:attribute
name="xsi:schemaLocation">http://www.xml.com/xml/unit/newUnit.xsd</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
This is tested with Saxon 6.5.3
Regards,
Mukul
--- Seng Kiat Lim <limsengkiat83(_at_)hotmail(_dot_)com> wrote:
XML document
<?xml version="1.0"?>
<Unit xmlns="http://www.xml.com/xml/unit"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.xml.com/xml/unit
unit.xsd">
<Units>
<Unit_Code>5555</Unit_Code>
<Unit_Name>System</Unit_Name>
</Units>
</Unit>
XSL Stylesheet
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:unit="http://www.monash.edu.au/xml/unitManagement"
<xsl:output method="xml"/>
<xsl:template match="/">
<xsl:element name="Unit_Planning"
xmlns="http://www.xml.com/xml/unit"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.xml.com/xml/unit
newUnit.xsd">
<xsl:for-each select="unit:Unit/unit:Units">
<xsl:element name="Unit">
<xsl:element name="Unit_Code">
<xsl:value-of select="unit:Unit_Code"/>
</xsl:element>
<xsl:element name="Unit_Name">
<xsl:value-of select="unit:Unit_Name"/>
</xsl:element>
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I wish to display XML that will validate to a new
XML schema file.
Hope to display XML
<?xml version="1.0"?>
<Unit xmlns="http://www.xml.com/xml/unit"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.xml.com/xml/unit
newUnit.xsd">
<Units>
<Unit_Code>5555</Unit_Code>
<Unit_Name>System</Unit_Name>
</Units>
</Unit>
Can anyone out there pls help me out? I fail to
display the exactly what I
want. I need to validate to a new schema from what I
create. It still be
generate the XML file but do not include any of the
schemalocation details
in the root element.
Can anyone show me how to do it in XSL? I wish to
know a way to validate to
a new schema and show all the details.
Thanks
--~------------------------------------------------------------------
XSL-List info and archive:
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
__________________________________
Yahoo! Mail Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.
http://mobile.yahoo.com/learn/mail
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--