Xslt 百叶窗
有人能帮我用XSLT把威尼斯盲人的XSD转换成俄罗斯娃娃设计吗?我读了一篇关于堆栈溢出的文章,文章的内容正好相反:在同事的帮助下,我终于得到了答案。它可能并不优雅,但它满足了我的迫切需要,这就是:Xslt 百叶窗,xslt,xsd,Xslt,Xsd,有人能帮我用XSLT把威尼斯盲人的XSD转换成俄罗斯娃娃设计吗?我读了一篇关于堆栈溢出的文章,文章的内容正好相反:在同事的帮助下,我终于得到了答案。它可能并不优雅,但它满足了我的迫切需要,这就是: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet exclude-result-prefixes='exsl' version="2.0" xmlns:com="http://canaldigital
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
exclude-result-prefixes='exsl'
version="2.0"
xmlns:com="http://canaldigital.com/tsi/XSD/V5.00"
xmlns:exsl="http://exslt.org/common"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="xsd:complexType">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template name="complexTypeElemEmbedded">
<xsl:param name="typeName"></xsl:param>
<xsl:variable name="typeNameNoNS" select="substring-after($typeName, ':')" />
<xsd:complexType>
<xsl:apply-templates select="//xsd:complexType[@name=$typeNameNoNS]/node()"></xsl:apply-templates>
</xsd:complexType>
</xsl:template>
<xsl:template match="xsd:element[@type]">
<xsl:choose>
<!-- All simple types have a name ending in the literal 'Type' -->
<xsl:when test="(ends-with(@type, 'Type'))">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:when>
<!-- this picks up the global complex types -->
<xsl:otherwise>
<xsl:copy>
<xsl:copy-of select="@*[(name()!='type')]"/>
<xsl:call-template name="complexTypeElemEmbedded">
<xsl:with-param name="typeName" select="@type"/>
</xsl:call-template>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
不清楚你在问什么,问题也太广泛了。请详细说明您希望实现的目标以及您迄今为止所做的尝试。如果可能,请举例说明。你可能会从你链接到的问题中得到足够的启发。我需要一个XSLT,它与链接到的文档中的相反,即Venetian Blind到Russian Doll,而不是Russian Doll到Venetian Blind。StackOverflow既不是代码编写服务,也不是工具/库推荐服务,因此,您必须尝试编写代码并请求特定的帮助,否则您的问题可能会被关闭。虽然这个问题问得不好,但从某种意义上说,它仍然是一个理解清楚的问题,我也觉得很有趣。链接问题给出了一个示例,说明了什么构成了“俄罗斯娃娃”样式的XSD,以及什么构成了“威尼斯盲人”XSD。可以公平地推断,链接的问题应该作为一个适当的例子,但这个问题是独特的。@Jefftopia感谢您的建议;实际上,你刚刚给了我一个从威尼斯盲人到俄罗斯玩偶转换的最后一步的想法,这样我就得到了一个元素,而不是一个完全非规范化的复杂类型。谢谢