Xpath 和 concat 元素和文本 [英] Xpath and concat elements and text

查看:34
本文介绍了Xpath 和 concat 元素和文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮帮我.我试图从不同类型的不同元素中连接元素 .结果应该是从 Mustermann 到卡夫

Please give me a helping hand. I tried to concat the elements <forename> from different elements with different types. The result should be From Mustermann to Kraft

<head>
              <persName type="sender" xml:id="ID.1">
                <forename>Max</forename>
                <surname>Mustermann</surname>
              </persName>
              <persName type="adresser" xml:id="ID.30">
                <forename>Susi</forename>
                <surname>Kraft</surname>
              </persName>
            </head>

我尝试了许多不同的样式,但问题是我无法在 concat 函数中导航.据我所知, concat 在同一空间中与字符串一起工作正常.不过看这也不太可能.我的错误是什么,你有解决办法吗.请我需要在 XPATH 而不是 XSLT.这也不起作用.:

I tried many different styles and the problem is that I am not able to navigate in the concat function. As far as I know concat is working fine with strings in the same space. But look at this also not possible. What is my mistake and do you have a solution for that. And please I need in XPATH not XSLT. This is also not working.:

//persName/concat( "This " , "is " , "a " , "test ", surename) 

知道为什么吗?

推荐答案

concat('From ',
       /head/persName[@type="sender"]/surname,
       ' to ',
       /head/persName[@type="adresser"]/surname)

xsh 中测试.

这篇关于Xpath 和 concat 元素和文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆