java - 无法在 json 转换期间为 xslt 中的单个对象添加数组
问题描述
```<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/ "> <xsl:apply-templates mode="body" /> </xsl:template> <xsl:template match="OneDispatcher" mode="body"><xsl:variable name="header" select="requestPayload/holdDesc"/><taskHeader> <creator>ON</creator> <orderInfo> <lineOfBusiness>IEN-Migration</lineOfBusiness> <orderSource>IEN-Migration</orderSource> </orderInfo><taskSource>IEN-Migration</taskSource><userId>wfm</userId></taskHeader><xsl:for-each select="FetchTaskDoc/document-payload/Array"><externalTaskIdList> <xsl:value-of select="externalTaskId"/></externalTaskIdList></xsl:for-each><holdCode>ONHOLD</holdCode><holdDesc><xsl:value-of select="$header"/></holdDesc></xsl:template></xsl:stylesheet>
above is the xslt code I am using and test1 is the result I am seeing for extenalTaskIdList key in json test2 is externalIdList I am looking for
```test1
{“taskHeader”:{“creator”:“ON”,“orderInfo”:{“lineOfBusiness”:“test”,“orderSource”:“test”},“taskSource”:“test”,“userId”:“testing " }, "holdCode": "tetsD", "externalTaskIdList": "1-9994912", "holdDesc": "Testing"} test2
"taskHeader": {
"creator": "ON",
"orderInfo": {
"lineOfBusiness": "test",
"orderSource": "test"
},
"taskSource": "test",
"userId": "testing"
},
"holdCode": "tetsD",
"externalTaskIdList": ["1-9994912"],
"holdDesc": "Testing"}
解决方案
推荐阅读
- firebase - 减少读取 Firestore 的数量
- azure-bot-service - 连接 QnA maker 与 azure 的 webapp Bot 服务
- griddb - Griddb Nosql - 使 Makefile:382 全递归时出错
- c# - 非可空类型的通用 throw 函数
- docker - 更改在 docker-compose 中拉取的图像的位置
- java - Android / MySQL:使用初始设置文本“请选择”从数据库填充微调器
- php - 如何使用 Laravel 和 Carbon 在两个 x 天之间进行查询?
- html - 到达 div 末尾时是否可以设置“border-radius”?
- elasticsearch - 弹性搜索中post、upsert和update之间的区别
- python - 如何访问@classmethod 中的实例变量?