小编Lat*_*ade的帖子

用于匹配文档中除特定元素中的文本节点之外的所有文本节点的Xpath

试图在XSLT中构建模板以匹配特定的Xpath案例.

在这个示例XML文档中,我想匹配整个文档中的所有文本,除了in <x>:

<root>
 <tag1> I want this text </tag1>
 <tag2> I want this text </tag2>
 <x> I don't want to match on this text </x>
 <tag3> I want this text </tag3>
</root>
Run Code Online (Sandbox Code Playgroud)

关于这个Xpath的任何想法?我正在尝试为它构建一个模板,以便针对这个特定情况转换我的文档.

我提出的远远不是这样的事情是行不通的:

<xsl:template match="text()[not(matches(.,x))]">
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

xml xslt xpath

5
推荐指数
1
解决办法
1025
查看次数

JSON 模式中的变量对象名称

我试图在 JSON 模式中定义以下内容:

"codenumber": {
     "12345": [
        {
           "prop1": "yes",
           "prop2": "no"
        }
     ]
  }
Run Code Online (Sandbox Code Playgroud)

codenumber 对象包含一个属性“12345”,它始终是一个包含数组的字符串编号。然而,数值可以改变,所以我不能像这样简单地定义它:

"codenumber": {
          "type": "object",
          "properties": {
              "12345": { 
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "prop1": { "type": "string" },
                        "prop2": { "type": "string" }
                    }
                }
              }
          }  
      }
Run Code Online (Sandbox Code Playgroud)

任何方式我都可以将第一个属性名称定义为任何类型的字符串?

json jsonschema

0
推荐指数
1
解决办法
2279
查看次数

标签 统计

json ×1

jsonschema ×1

xml ×1

xpath ×1

xslt ×1