For example, I'm trying to pick out the value "Application Library" from the following XML - ie, the value under content-node/localedata/title, where localedata@locale = "en".
例如,我试图从以下XML中选择值“Application Library” - 即content-node / localedata / title下的值,其中localedata @ locale =“en”。
<content-node objectid="6_NO2UF4I1186E1026H4BLVI08F1">
<localedata locale="de">
<title>Anwendungsbibliothek</title>
</localedata>
<localedata locale="en">
<title>Application Library</title>
</localedata>
<localedata locale="es">
<title>Biblioteca de aplicaciones</title>
</localedata>
</content-node>
Specifically, what XPath expression do I put in the xsl:template@match value? I think it should be something like this, except I don't know how to match for the hardcoded value "en":
具体来说,我在xsl:template @ match值中添加了什么XPath表达式?我认为它应该是这样的,除了我不知道如何匹配硬编码值“en”:
<xsl:template match="localedata[@locale = en]">
Am I on the right track here, or is there some other way I should go about this?
我在这里是正确的轨道,还是有其他方式我应该这样做?
1 个解决方案
#1
I would say yes, you should be on the right track. I can't seem to find any samples to verify and confirm this - but you should have no trouble trying and verifying this.
我会说是的,你应该走在正确的轨道上。我似乎无法找到任何样本来验证和确认 - 但你应该没有尝试和验证这一点。
I say : go for it!
我说:去吧!
Looks like you'll have to adapt your XSL just a tiny bit:
看起来你必须调整你的XSL一点点:
<xsl:template match="localedata[@locale='en']">
With this (remove spaces after @locale, put the value in ' ... ') everything should be fine.
有了这个(删除@locale之后的空格,把值放在'...'),一切都应该没问题。
Marc
#1
I would say yes, you should be on the right track. I can't seem to find any samples to verify and confirm this - but you should have no trouble trying and verifying this.
我会说是的,你应该走在正确的轨道上。我似乎无法找到任何样本来验证和确认 - 但你应该没有尝试和验证这一点。
I say : go for it!
我说:去吧!
Looks like you'll have to adapt your XSL just a tiny bit:
看起来你必须调整你的XSL一点点:
<xsl:template match="localedata[@locale='en']">
With this (remove spaces after @locale, put the value in ' ... ') everything should be fine.
有了这个(删除@locale之后的空格,把值放在'...'),一切都应该没问题。
Marc