I have a problem with the position of the namespace in the xml of the result after xsl conversion.
My transform stylesheet looks like
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <xsl:output indent="yes" method="xml" /> <xsl:template match="/"> <xsl:element name="SmartDriveUpdates"> <xsl:attribute name="xsi:noNamespaceSchemaLocation"> <xsl:text>LightSpeedXMLSchema.xsd</xsl:text> </xsl:attribute> ... </xsl:element>
In the output xml file, I want to get root node as
<SmartDriveUpdates xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="LightSpeedXMLSchema.xsd">
But instead I have
<SmartDriveUpdates xsi:noNamespaceSchemaLocation="LightSpeedXMLSchema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
I also tried to predict the root node in the xsl stylesheet as
<SmartDriveUpdates xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="LightSpeedXMLSchema.xsd"> ... </SmartDriveUpdates>
But I get the same wrong result.
Convert to xml file using the Transform method from the system.xml.xsl.xslcompiledtransform.NET class. For this purpose I use PowerShell:
Function Convert-WithXslt($originalXmlFilePath, $xslFilePath, $outputFilePath) {
Can someone help me solve this?
thanks
source share