0
私のXMLをバックスラッシュをstirng翻訳:XSLT 1.0 - 二重のバックスラッシュに
<workorder>
<specifications>
<hpath>94 \ 72</hpath>
<classdesc></classdesc>
</specifications>
</workorder>
私のXSLT:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
<xsl:output method="text" encoding="UTF-8" />
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="workorder">
<xsl:apply-templates select="specifications" />
</xsl:template>
<xsl:template match="specifications">
<xsl:text>{
"Hierarchy Path"="</xsl:text>
<xsl:value-of select="translate(//workorder/specifications/hpath,'\','\\')" />
<xsl:text>"
}</xsl:text>
</xsl:template>
</xsl:stylesheet>
期待出力は次のとおりです。
{
"Hierarchy Path"="94 \\ 72"
}
電流出力は次のようになります。
{
"Hierarchy Path"="94 \ 72"
}
問題:json形式を「現在の出力」として送信すると、有効なjson形式ではありません。 "期待される出力"として送信すると、有効なjson形式です。 助けてください。前もって感謝します。
非常にありがとうございます:) –