⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wsdl-viewer.xsl

📁 一个XML文件的两种解析方法
💻 XSL
📖 第 1 页 / 共 5 页
字号:
				<xsl:call-template name="render-type">
					<xsl:with-param name="type-local-name"
						select="$type-name" />
				</xsl:call-template>

				<xsl:call-template name="render.source-code-link" />

				<xsl:variable name="type-tree"
					select="$consolidated-xsd[@name = $type-name and not(xsd:simpleType)][1]" />
				<xsl:apply-templates select="$type-tree"
					mode="operations.message.part" />
			</div>
		</xsl:if>
	</xsl:template>
	<xsl:template match="ws:portType" mode="operations">
		<div>
			<xsl:if test="position() != last()">
				<xsl:attribute name="class">port</xsl:attribute>
			</xsl:if>
			<xsl:if test="$ENABLE-PORTTYPE-NAME">
				<h3>
					<a name="{concat($PORT-PREFIX, generate-id(.))}">
						<xsl:value-of select="$PORT-TYPE-TEXT" />
						<xsl:text>
</xsl:text>
						<b>
							<xsl:value-of select="@name" />
						</b>
					</a>
					<xsl:call-template name="render.source-code-link" />
				</h3>
			</xsl:if>
			<ol>
				<xsl:apply-templates select="ws:operation"
					mode="operations">
					<xsl:sort select="@name" />
				</xsl:apply-templates>
			</ol>
		</div>
	</xsl:template>
	<xsl:template match="ws:operation" mode="operations">
		<xsl:variable name="binding-info"
			select="$consolidated-wsdl/ws:binding[@type = current()/../@name or substring-after(@type, ':') = current()/../@name]/ws:operation[@name = current()/@name]" />
		<li>
			<xsl:if test="position() != last()">
				<xsl:attribute name="class">operation</xsl:attribute>
			</xsl:if>
			<big>
				<b>
					<a
						name="{concat($OPERATIONS-PREFIX, generate-id(.))}">
						<xsl:value-of select="@name" />
					</a>
				</b>
			</big>
			<div class="value">
				<xsl:text>
</xsl:text>
				<xsl:call-template name="render.source-code-link" />
			</div>

			<xsl:if
				test="$ENABLE-DESCRIPTION and string-length(ws:documentation) &gt; 0">
				<div class="label">Description:</div>
				<div class="value">
					<xsl:value-of select="ws:documentation"
						disable-output-escaping="yes" />
				</div>
			</xsl:if>

			<xsl:if test="$ENABLE-STYLEOPTYPEPATH">
				<xsl:variable name="binding-operation"
					select="$binding-info/*[local-name() = 'operation']" />
				<xsl:if test="$binding-operation/@style">
					<div class="label">Style:</div>
					<div class="value">
						<xsl:value-of
							select="$binding-operation/@style" />
					</div>
				</xsl:if>

				<div class="label">Operation type:</div>
				<div class="value">
					<xsl:choose>
						<xsl:when
							test="$binding-info/ws:input[not(../ws:output)]">
							<i>One-way.</i>
							The endpoint receives a message.
						</xsl:when>
						<xsl:when
							test="$binding-info/ws:input[following-sibling::ws:output]">
							<i>Request-response.</i>
							The endpoint receives a message, and sends a
							correlated message.
						</xsl:when>
						<xsl:when
							test="$binding-info/ws:input[preceding-sibling::ws:output]">
							<i>Solicit-response.</i>
							The endpoint sends a message, and receives a
							correlated message.
						</xsl:when>
						<xsl:when
							test="$binding-info/ws:output[not(../ws:input)]">
							<i>Notification.</i>
							The endpoint sends a message.
						</xsl:when>
						<xsl:otherwise>unknown</xsl:otherwise>
					</xsl:choose>
				</div>

				<xsl:if
					test="string-length($binding-operation/@soapAction) &gt; 0">
					<div class="label">SOAP action:</div>
					<div class="value">
						<xsl:value-of
							select="$binding-operation/@soapAction" />
					</div>
				</xsl:if>

				<xsl:if test="$binding-operation/@location">
					<div class="label">HTTP path:</div>
					<div class="value">
						<xsl:value-of
							select="$binding-operation/@location" />
					</div>
				</xsl:if>
			</xsl:if>
			<xsl:apply-templates select="ws:input|ws:output|ws:fault"
				mode="operations.message">
				<xsl:with-param name="binding-data"
					select="$binding-info" />
			</xsl:apply-templates>
		</li>
	</xsl:template>
	<xsl:template match="ws:input|ws:output|ws:fault"
		mode="operations.message">
		<xsl:param name="binding-data" />
		<xsl:if test="$ENABLE-INOUTFAULT">
			<div class="label">
				<xsl:value-of
					select="concat(translate(substring(local-name(.), 1, 1), 'abcdefghijklmnoprstuvwxyz', 'ABCDEFGHIJKLMNOPRSTUVWXYZ'), substring(local-name(.), 2), ':')" />
			</div>

			<xsl:variable name="msg-local-name"
				select="substring-after(@message, ':')" />
			<xsl:variable name="msg-name">
				<xsl:choose>
					<xsl:when test="$msg-local-name">
						<xsl:value-of select="$msg-local-name" />
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="@message" />
					</xsl:otherwise>
				</xsl:choose>
			</xsl:variable>

			<xsl:variable name="msg"
				select="$consolidated-wsdl/ws:message[@name = $msg-name]" />
			<xsl:choose>
				<xsl:when test="$msg">
					<xsl:apply-templates select="$msg"
						mode="operations.message">
						<xsl:with-param name="binding-data"
							select="$binding-data/ws:*[local-name(.) = local-name(current())]/*" />
					</xsl:apply-templates>
				</xsl:when>
				<xsl:otherwise>
					<div class="value">
						<i>none</i>
					</div>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:if>
	</xsl:template>
	<xsl:template match="ws:message" mode="operations.message">
		<xsl:param name="binding-data" />
		<div class="value">
			<xsl:value-of select="@name" />
			<xsl:if test="$binding-data">
				<xsl:text> (</xsl:text>
				<xsl:value-of select="name($binding-data)" />
				<xsl:variable name="use" select="$binding-data/@use" />
				<xsl:if test="$use">
					<xsl:text>, use = </xsl:text>
					<xsl:value-of select="$use" />
				</xsl:if>
				<xsl:variable name="part" select="$binding-data/@part" />
				<xsl:if test="$part">
					<xsl:text>, part = </xsl:text>
					<xsl:value-of select="$part" />
				</xsl:if>
				<xsl:text>)</xsl:text>
			</xsl:if>
			<xsl:call-template name="render.source-code-link" />
		</div>

		<xsl:apply-templates select="ws:part" mode="operations.message" />
	</xsl:template>
	<xsl:template match="ws:part" mode="operations.message">
		<div class="value box" style="margin-bottom: 3px">
			<xsl:choose>
				<xsl:when test="string-length(@name) &gt; 0">
					<b>
						<xsl:value-of select="@name" />
					</b>

					<xsl:variable name="elem-or-type">
						<xsl:choose>
							<xsl:when test="@type">
								<xsl:value-of select="@type" />
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="@element" />
							</xsl:otherwise>
						</xsl:choose>
					</xsl:variable>

					<xsl:variable name="type-local-name"
						select="substring-after($elem-or-type, ':')" />
					<xsl:variable name="type-name">
						<xsl:choose>
							<xsl:when test="$type-local-name">
								<xsl:value-of select="$type-local-name" />
							</xsl:when>
							<xsl:when test="$elem-or-type">
								<xsl:value-of select="$elem-or-type" />
							</xsl:when>
							<xsl:otherwise>unknown</xsl:otherwise>
						</xsl:choose>
					</xsl:variable>

					<xsl:call-template name="render-type">
						<xsl:with-param name="type-local-name"
							select="$type-name" />
					</xsl:call-template>

					<xsl:variable name="part-type"
						select="$consolidated-xsd[@name = $type-name and not(xsd:simpleType)][1]" />
					<xsl:apply-templates select="$part-type"
						mode="operations.message.part" />

				</xsl:when>
				<xsl:otherwise>
					<i>none</i>
				</xsl:otherwise>
			</xsl:choose>
		</div>
	</xsl:template>

	<!--
		@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
		End of included transformation: wsdl-viewer-operations.xsl
		@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
	-->



	<!--
		@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
		Begin of included transformation: wsdl-viewer-xsd-tree.xsl
		@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
	-->
	<xsl:template match="xsd:simpleType" mode="operations.message.part" />
	<xsl:template name="recursion.should.continue">
		<xsl:param name="anti.recursion" />
		<xsl:param name="recursion.label" />
		<xsl:param name="recursion.count">1</xsl:param>
		<xsl:variable name="has.recursion"
			select="contains($anti.recursion, $recursion.label)" />
		<xsl:variable name="anti.recursion.fragment"
			select="substring-after($anti.recursion, $recursion.label)" />
		<xsl:choose>
			<xsl:when test="$recursion.count &gt; $ANTIRECURSION-DEPTH" />

			<xsl:when
				test="not($ENABLE-ANTIRECURSION-PROTECTION) or string-length($anti.recursion) = 0 or not($has.recursion)">
				<xsl:text>1</xsl:text>
			</xsl:when>

			<xsl:otherwise>
				<xsl:call-template name="recursion.should.continue">
					<xsl:with-param name="anti.recursion"
						select="$anti.recursion.fragment" />
					<xsl:with-param name="recursion.label"
						select="$recursion.label" />
					<xsl:with-param name="recursion.count"
						select="$recursion.count + 1" />
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="xsd:complexType"
		mode="operations.message.part">
		<xsl:param name="anti.recursion" />

		<xsl:variable name="recursion.label"
			select="concat('[', @name, ']')" />
		<xsl:variable name="recursion.test">
			<xsl:call-template name="recursion.should.continue">
				<xsl:with-param name="anti.recursion"
					select="$anti.recursion" />
				<xsl:with-param name="recursion.label"
					select="$recursion.label" />
			</xsl:call-template>
		</xsl:variable>

		<xsl:choose>
			<xsl:when test="string-length($recursion.test) != 0">
				<xsl:apply-templates select="*"
					mode="operations.message.part">
					<xsl:with-param name="anti.recursion"
						select="concat($anti.recursion, $recursion.label)" />
				</xsl:apply-templates>
			</xsl:when>
			<xsl:otherwise>
				<small style="color:blue">
					<xsl:value-of select="$RECURSIVE" />
				</small>
			</xsl:otherwise>
		</xsl:choose>

	</xsl:template>
	<xsl:template match="xsd:complexContent"
		mode="operations.message.part">
		<xsl:param name="anti.recursion" />

		<xsl:apply-templates select="*"
			mode="operations.message.part">
			<xsl:with-param name="anti.recursion"
				select="$anti.recursion" />
		</xsl:apply-templates>
	</xsl:template>
	<xsl:template
		match="xsd:complexType[descendant::xsd:attribute[ not(@*[local-name() = 'arrayType']) ]]"
		mode="operations.message.part">
		<xsl:param name="anti.recursion" />
		<xsl:variable name="recursion.label"
			select="concat('[', @name, ']')" />
		<xsl:variable name="recursion.test">
			<xsl:call-template name="recursion.should.continue">
				<xsl:with-param name="anti.recursion"
					select="$anti.recursion" />
				<xsl:with-param name="recursion.label"
					select="$recursion.label" />
			</xsl:call-template>
		</xsl:variable>

		<xsl:choose>
			<xsl:when test="string-length($recursion.test) != 0">
				<ul type="circle">
					<xsl:apply-templates select="*"
						mode="operations.message.part">
						<xsl:with-param name="anti.recursion"
							select="concat($anti.recursion, $recursion.label)" />
					</xsl:apply-templates>
				</ul>
			</xsl:when>
			<xsl:otherwise>
				<small style="color:blue">
					<xsl:value-of select="$RECURSIVE" />
				</small>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="xsd:restriction | xsd:extension"
		mode="operations.message.part">
		<xsl:param name="anti.recursion" />
		<xsl:variable name="type-local-name"
			select="substring-after(@base, ':')" />
		<xsl:variable name="type-name">
			<xsl:choose>
				<xsl:when test="$type-local-name">
					<xsl:value-of select="$type-local-name" />
				</xsl:when>
				<xsl:when test="@base">
					<xsl:value-of select="@base" />
				</xsl:when>
				<xsl:otherwise>unknown type</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="base-type"
			select="$consolidated-xsd[@name = $type-name][1]" />
		<!-- xsl:if test="not($type/@abstract)">
			<xsl:apply-templates select="$type"/>
			</xsl:if -->
		<xsl:if test="$base-type != 'Array'">
			<xsl:apply-templates select="$base-type"
				mode="operations.message.part">
				<xsl:with-param name="anti.recursion"
					select="$anti.recursion" />

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -