Arrays XSLT1.0:在JSON数组中使用XSLT/Remove-defualt引号格式化JSON输出

Arrays XSLT1.0:在JSON数组中使用XSLT/Remove-defualt引号格式化JSON输出,arrays,json,xslt,xslt-1.0,xml-to-json,Arrays,Json,Xslt,Xslt 1.0,Xml To Json,在XSLT转换之后,我得到了以下JSON响应。“name”数组中的值需要显示为“ABC”、“XYZ” 有效载荷 <Data> <Mapping> <LocationID>001</LocationID> <GeoX>1.00</GeoX> <GeoY>2.00</GeoY> </Mapping> <Mapping> <LocationID&g

在XSLT转换之后,我得到了以下JSON响应。
“name”
数组中的值需要显示为
“ABC”、“XYZ”

有效载荷

<Data>
 <Mapping>
   <LocationID>001</LocationID>
   <GeoX>1.00</GeoX>
   <GeoY>2.00</GeoY>
 </Mapping>
 <Mapping>
   <LocationID>002</LocationID>
   <GeoX>56.00</GeoX>
   <GeoY>42.00</GeoY>
 <Mapping>
</Data>
XML输出

<Destination>
  <Locations>
    <Name>"ABC","XYZ"</Name>
  </Locations>
</Destination>
"Destination": [
    {
        "Locations": {
            "Name": [
                "\"ABC\",\"XYZ\""
            ]
        },
"Destination": [
    {
        "Locations": {
            "Name": [
                "ABC","XYZ"
            ]
        },
"Destination": [
    {
        "Locations": {
            "Name": [
                "ABC",
                "XYZ"
            ]
        },
预期JSON输出

<Destination>
  <Locations>
    <Name>"ABC","XYZ"</Name>
  </Locations>
</Destination>
"Destination": [
    {
        "Locations": {
            "Name": [
                "\"ABC\",\"XYZ\""
            ]
        },
"Destination": [
    {
        "Locations": {
            "Name": [
                "ABC","XYZ"
            ]
        },
"Destination": [
    {
        "Locations": {
            "Name": [
                "ABC",
                "XYZ"
            ]
        },

当我将XML转换为JSON时,会出现“\'ABC\”、“XYZ\”转义字符。有没有办法克服这个问题。

我可以通过如下更改上述代码来解决这个问题

以前的代码:

<xsl:template match="//Data">
   <Destination>
      <Locations>
          <xsl:text disable-output-escaping="yes">&lt;?xml-multiple?&gt;</xsl:text>
            <Name>
             <jsonArray>
               <xsl:for-each select="Mapping">
                  <xsl:choose>
                     <xsl:when test="LocationID='001'">"ABC"</xsl:when>
                     <xsl:when test="LocationID='002'">"XYZ"</xsl:when>
                     <xsl:otherwise>"NEW"</xsl:otherwise>
                  </xsl:choose>
               </xsl:for-each>
              </jsonArray>
            </Name>
        </Locations>
    </Destination>
</xsl:template>
<xsl:template match="//Data">
   <Destination>
      <Locations>
               <xsl:for-each select="Mapping">
                  <xsl:choose>
                     <xsl:when test="LocationID='001'"><Name>ABC</Name></xsl:when>
                     <xsl:when test="LocationID='002'"><Name>XYZ</Name></xsl:when>
                     <xsl:otherwise><Name>NEW</Name></xsl:otherwise>
                  </xsl:choose>
               </xsl:for-each>
        </Locations>
    </Destination>
</xsl:template>

请发布一个显示输入和完整XSLT的文件。您当前的代码没有生成您显示的输出。您好,Micheal,我无法共享类似的内容,因为我无法整体共享XSLT。我知道如果有困难,我使用的是以前的有效负载,我希望在
Name
数组中以
“ABC”,“XYZ”
的形式接收值。我希望这能让您明白,您要求我们修复我们看不见的代码。我投票结束这个问题。很抱歉给您添麻烦,我理解。我将关闭它,我在想,如果我们将ABC和XYZ分配给一个变量,并在最后连接,这样将能够实现
“ABC”,“XYZ”
,生成
“ABC”,“XYZ”
的输出没有问题,正如我已经展示的那样:。问题是,您还有其他代码可以转义引号。我们不知道这段代码是如何工作的,因此无法告诉它需要什么输入来生成预期的JSON,如果可能的话,或者如果不可能的话,需要如何修改它。