如何在xslt-1.0中使用SOH和ETX
如何使用 xslt -1.0 设置 SOH 和 ETX
我尝试了多种方法来达到输出,因为数字代码不接受此 xslt-1.0 并且这里编码是 utf-8。
如何在其中使用此十六进制代码...它不起作用,我需要做什么才能使其工作
SOH : 
ETX : < /code>
我也尝试过下面的一个来实现结果输出,但它不是..请大家建议一些事情...不,
<?xml version="1.0" encoding="US-ASCII" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:char="java.lang.Character" version="1.0">
<xsl:output method="text" encoding="US-ASCII" />
<xsl:template match="/">
<xsl:value-of select="char:toString(1)"></xsl:value-of>
</xsl:template>
</xsl:stylesheet>
我已经在我的xslt中应用了上述逻辑,当我使用它时,它抛出错误:
XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}运行时,XPathNavigator {urn:schemas-microsoft-com:xslt-debug}当前,双精度 {urn:schemas-microsoft-com:xslt-debug}位置, 双 {urn:schemas-microsoft-com:xslt-debug} 最后,IList`1 {urn:schemas-microsoft-com:xslt-debug}命名空间
和文件正在使用 0KB 创建,
<xsl:value-of select="char:toString(1)">
如果只是评论它工作正常......
这里是下面的 xslt
<?xml version="1.0" encoding="us-ascii"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:char="java.lang.Character" version="1.0" >
<xsl:output method="text" indent="no" omit-xml-declaration ="yes" encoding="us-ascii"/>
<xsl:param name="PackageId" />
<xsl:param name="SequenceNum" />
<xsl:template match="/">
<xsl:value-of select="char:toString(1)"></xsl:value-of>
<xsl:apply-templates mode="block1" select="NewDataSet/Table1[CTC_PACKAGE_ID =$PackageId][position()=1]"/>
<xsl:apply-templates mode="block2" select="NewDataSet/Table[CTD_CTD_PKG_ID =$PackageId][CTD_SEQ_NUM =$SequenceNum]"/>
</xsl:template>
<xsl:template mode="block1" match="Table1">
...some code....
</xsl:template>
<xsl:template mode="block2" match="Table">
...some code....
</xsl:template>
how to set SOH and ETX by using xslt -1.0
I have tried numerous ways i dint reached output, since numeric code are not accepting this xslt-1.0 and here encoding is utf-8.
how to use this hexadecimal code in it ...it was not working what do i need to do for make it work
SOH :
ETX :
I have tried this below one also for to achieve the resultant output but it was not ..guys kindly suggest some thing...nah
<?xml version="1.0" encoding="US-ASCII" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:char="java.lang.Character" version="1.0">
<xsl:output method="text" encoding="US-ASCII" />
<xsl:template match="/">
<xsl:value-of select="char:toString(1)"></xsl:value-of>
</xsl:template>
</xsl:stylesheet>
I have applied the above logic in my xslt when i use this it was throwing error :
XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, IList`1 {urn:schemas-microsoft-com:xslt-debug}namespaces
and file was creating with 0KB
<xsl:value-of select="char:toString(1)">
if just comment on that it was working fine...
here is below xslt
<?xml version="1.0" encoding="us-ascii"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:char="java.lang.Character" version="1.0" >
<xsl:output method="text" indent="no" omit-xml-declaration ="yes" encoding="us-ascii"/>
<xsl:param name="PackageId" />
<xsl:param name="SequenceNum" />
<xsl:template match="/">
<xsl:value-of select="char:toString(1)"></xsl:value-of>
<xsl:apply-templates mode="block1" select="NewDataSet/Table1[CTC_PACKAGE_ID =$PackageId][position()=1]"/>
<xsl:apply-templates mode="block2" select="NewDataSet/Table[CTD_CTD_PKG_ID =$PackageId][CTD_SEQ_NUM =$SequenceNum]"/>
</xsl:template>
<xsl:template mode="block1" match="Table1">
...some code....
</xsl:template>
<xsl:template mode="block2" match="Table">
...some code....
</xsl:template>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定你有什么例外,因为你所展示的内容似乎并不完整。 0x01 不是有效的 Xml 字符,这可能是异常的原因。我创建了一个稍微不同的样式表版本,如下所示:
为了防止由于无效字符而失败,我需要在写入响应的编写器中禁用字符检查:
导致以下输出的结果:
如您所见字符被写入输出,没有任何异常。
I am not sure what exception you had since what you showed does not seem to be complete. 0x01 is not a valid Xml character and this might be the reason for the exception. I created a slightly different version of your stylesheet that looks like this:
To prevent it from failing due to the invalid character I needed to disable character checking in the writer that writes the response:
what resulted in the following output:
As you can see the character was written to the output without and there was no exception.