如何显示XML doc的正确输出? [英] How do I show correct output from XML doc?

查看:72
本文介绍了如何显示XML doc的正确输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从xml文档中获取以下输出,但我不知道该怎么做。有人可以帮忙吗?



所需的输出

 <?  xml    版本  =  1.0   编码  =  UTF-8  >  
< 整合 >
< ProtectionOrderStatus >
< ; ProtectionOrderStatusCode > DELETED < / ext:ProtectionOrderStatusCode >
< / ProtectionOrderStatus >
< /整合 >





放入文件

 <?  xml     version   =  1.0    encoding   =  UTF-8  >  
< 集成 >
< ProtectionOrder >
< 已删除 > true < / Deleted >
< ProtectionOrderNumber > 12 < / ProtectionOrderNumber >
< 状态 & gt;
< 状态 >
< 当前 > true < / Current >
< 有效 > < / Active >
< 日期 > 03/16/2017 < / Date >
< 键入 Word = SBJO > 由司法官员签名< /类型 >
< /状态 >
< /状态 >
< / ProtectionOrder >
< / Integration >





我的尝试:



我不知道怎么样去做吧。

解决方案

我确实搞清楚了。这就是我在现有的xslt中所做的。我意识到我忘了添加xslt代码。抱歉。

 <   ext:ProtectionOrderStatus  >  
< xsl:选择 >
< xsl:when test = 已删除='true' >
< ext:ProtectionOrderStatusCode >
< xsl:text > DELETED < / xsl:text >
< / ext:ProtectionOrderStatusCode >
< / xsl : >
< xsl:否则 >
< xsl:value-of select =


vStatusWord / >
< / xsl:否则 >
< / xsl:choose >
< / ext:ProtectionOrderStatus >


我找到了解决方案。这是因为我想在select语句中显示值DELETED。

 <   ext:ProtectionOrderStatus  < span class =code-keyword>>  
< xsl:choose >
< xsl:何时 test = 已删除='true' >
< ext:ProtectionOrderStatusCode >
< xsl:value-of 选择 = 名称(已删除) / >
< / ext:ProtectionOrderStatusCode >
< / xsl:when >
< xsl:否则 >
< xsl:value-of 选择 =

I would like to get the following output from xml document but I am not sure how to do it. Can someone help please?

Desired output

<?xml version="1.0" encoding="UTF-8"?>
<Integration>
   <ProtectionOrderStatus>
        <ProtectionOrderStatusCode>DELETED</ext:ProtectionOrderStatusCode>
    </ProtectionOrderStatus>
</Integration>



In put document

<?xml version="1.0" encoding="UTF-8"?>
<Integration>
	<ProtectionOrder>
		<Deleted>true</Deleted>
		<ProtectionOrderNumber>12</ProtectionOrderNumber>
		<Statuses>
			<Status>
				<Current>true</Current>
				<Active>Yes</Active>
				<Date>03/16/2017</Date>
				<Type Word="SBJO">Signed By Judicial Officer</Type>
			</Status>
		</Statuses>
	</ProtectionOrder>
</Integration>



What I have tried:

I am not sure how to go about it.

解决方案

I did figure this out. This is what I did in existing xslt. I realized I forgot to add the xslt code. My apologies.

<ext:ProtectionOrderStatus>
	<xsl:choose>
		<xsl:when test="Deleted='true'">
			<ext:ProtectionOrderStatusCode>
				<xsl:text>DELETED</xsl:text>
			</ext:ProtectionOrderStatusCode>
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="


vStatusWord"/> </xsl:otherwise> </xsl:choose> </ext:ProtectionOrderStatus>


I found a solution. This is because I want to display the word DELETED in the select statement for the value.

<ext:ProtectionOrderStatus>
	<xsl:choose>
		<xsl:when test="Deleted='true'">
			<ext:ProtectionOrderStatusCode>
				<xsl:value-of select ="name(Deleted)"/>
			</ext:ProtectionOrderStatusCode>
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="


这篇关于如何显示XML doc的正确输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆