Created
November 21, 2011 23:04
-
-
Save dex4er/1384287 to your computer and use it in GitHub Desktop.
XSLT tools for XSD and WSDL schemas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<xsl:stylesheet version="2.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" | |
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | |
<xsl:output version="1.0" encoding="utf-8" indent="yes" name="xml" /> | |
<xsl:template match="/"> | |
<xsl:apply-templates /> | |
</xsl:template> | |
<xsl:template match="xsd:schema"> | |
<xsl:copy-of select="document(xsd:import/@schemaLocation)" /> | |
</xsl:template> | |
<xsl:template match="@*|node()"> | |
<xsl:copy> | |
<xsl:apply-templates select="@*|node()" /> | |
</xsl:copy> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<xsl:stylesheet version="2.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" | |
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | |
<xsl:output version="1.0" encoding="utf-8" indent="yes" name="xml" /> | |
<xsl:template match="/"> | |
<xsl:apply-templates /> | |
</xsl:template> | |
<xsl:template match="xsd:import/@schemaLocation" /> | |
<xsl:template match="xsd:import"> | |
<xsl:copy> | |
<xsl:apply-templates select="@*|node()|processing-instruction()|comment()" /> | |
</xsl:copy> | |
</xsl:template> | |
<xsl:template match="@*|node()"> | |
<xsl:copy> | |
<xsl:apply-templates select="@*|node()|processing-instruction()|comment()" /> | |
</xsl:copy> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<xsl:stylesheet version="2.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" | |
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | |
<xsl:output version="1.0" encoding="utf-8" indent="yes" name="xml" /> | |
<xsl:template match="/"> | |
<xsl:apply-templates /> | |
</xsl:template> | |
<xsl:template match="*[namespace-uri()='http://www.w3.org/2001/XMLSchema']"> | |
<xsl:element name="xsd:{local-name()}" namespace="http://www.w3.org/2001/XMLSchema"> | |
<xsl:apply-templates select="@*|node()"/> | |
</xsl:element> | |
</xsl:template> | |
<xsl:template match="@*|node()"> | |
<xsl:copy> | |
<xsl:apply-templates select="@*|node()" /> | |
</xsl:copy> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<xsl:stylesheet version="2.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" | |
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | |
<xsl:output version="1.0" encoding="utf-8" indent="yes" name="xml" /> | |
<xsl:template match="/"> | |
<xsl:apply-templates /> | |
</xsl:template> | |
<xsl:template match="xsd:schema"> | |
<xsl:variable name="filename" select="concat(replace(replace(@targetNamespace, '^https?://', ''), '[^a-zA-Z0-9_.+-]', '_'), '.xsd')" /> | |
<xsl:result-document href="{$filename}" format="xml"> | |
<xsl:copy-of select="." /> | |
</xsl:result-document> | |
<xsl:element name="xsd:schema" namespace="http://www.w3.org/2001/XMLSchema"> | |
<xsl:element name="xsd:import"> | |
<xsl:attribute name="namespace"> | |
<xsl:value-of select="@targetNamespace" /> | |
</xsl:attribute> | |
<xsl:attribute name="schemaLocation"> | |
<xsl:value-of select="$filename" /> | |
</xsl:attribute> | |
</xsl:element> | |
</xsl:element> | |
</xsl:template> | |
<xsl:template match="@*|node()"> | |
<xsl:copy> | |
<xsl:apply-templates select="@*|node()" /> | |
</xsl:copy> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment