📄 xmltohtml.xsl
字号:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ws="http://schemas.xmlsoap.org/wsdl/"
xmlns:ws2="http://www.w3.org/ns/wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:local="http://tomi.vanek.sk/xml/wsdl-viewer" version="1.0"
exclude-result-prefixes="ws ws2 xsd soap local">
<xsl:template match="ws:definitions">
<html>
<body>
<xsl:apply-templates select="ws:service" mode="service-start" />
<table>
<tr style="color:blue">
<td>Name:</td>
<td>
<xsl:value-of select="@name" />
</td>
</tr>
<tr style="color:blue">
<td>Target Namespace:</td>
<td>
<xsl:value-of select="@targetNamespace" />
</td>
</tr>
<xsl:apply-templates select="ws:service" mode="service-middle" />
</table>
<xsl:apply-templates select="ws:portType" />
</body>
</html>
</xsl:template>
<xsl:template match="ws:port" mode="port-binding">
<xsl:variable name="bindingname"
select="substring-after(@binding, ':')" />
<xsl:apply-templates select="//ws:binding[@name=$bindingname]" />
</xsl:template>
<xsl:template match="ws:binding">
<tr style="color:blue">
<td>Default Style:</td>
<td>
<xsl:value-of select="*[local-name()='binding']/@style" />
</td>
</tr>
<tr style="color:blue">
<td>Transport:</td>
<td>
<xsl:value-of select="*[local-name()='binding']/@transport" />
</td>
</tr>
<tr style="color:blue">
<td>Operations:</td>
<td></td>
</tr>
<xsl:for-each select="./*">
<tr style="color:blue">
<td></td>
<td>
<xsl:value-of select="@name" />
</td>
</tr>
</xsl:for-each>
</xsl:template>
<xsl:template match="ws:service" mode="service-start">
<h2>Web Service:
<xsl:value-of select="@name" />
</h2>
</xsl:template>
<xsl:template match="ws:service" mode="service-middle">
<p/>
<tr style="font-weight:bold;">
<td>Port:</td>
<td>
<xsl:value-of select="ws:port/@name" />
</td>
</tr>
<tr style="color:blue">
<td>Location:</td>
<td>
<xsl:value-of select="ws:port/*[local-name()='address']/@location" />
</td>
</tr>
<xsl:apply-templates select="ws:port" mode="port-binding" />
</xsl:template>
<xsl:template match="ws:portType">
<h3>Operations</h3>
<h4>Port Type: <xsl:value-of select="@name" /></h4>
<xsl:variable name="portType-name" select="@name" />
<table style="color:blue">
<xsl:for-each select="ws:operation">
<xsl:variable name="operation-name" select="@name" />
<tr>
<td style="font-weight:bold;color:black">
<xsl:value-of select="@name" />
</td>
<td></td>
</tr>
<xsl:for-each select="./*" >
<xsl:variable name="operation-local-name" select="local-name()" />
<xsl:variable name="message" select="substring-after(@message, ':')" />
<xsl:variable name="binding-operation-local-name" select="//ws:binding/*[@name=$operation-name]/*" />
<tr>
<td style="color:black">
<xsl:value-of select="$operation-local-name" />
</td>
<td>
<xsl:value-of select="$message" /> ( soap:body use = <xsl:value-of select="$binding-operation-local-name/*[local-name()='body']/@use" /> )
</td>
</tr>
<xsl:apply-templates select="//ws:message[@name=$message]" />
</xsl:for-each>
</xsl:for-each>
</table>
</xsl:template>
<xsl:template match="ws:message">
<xsl:for-each select="./*">
<tr >
<td></td>
<td>
<xsl:value-of select="@name" />
type: <xsl:value-of select="substring-after(@type, ':')" />
</td>
</tr>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -