xsl用于多值字符串的问题 [英] problem with xsl for multivalue strings

查看:38
本文介绍了xsl用于多值字符串的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个像这样的记录的xml:


< a:响应>

< a:href> http://服务器/public/sol/comp/1049306.eml</a:href>

< a:propstat>

< a:status> HTTP / 1.1 200 OK< / a:状态>

< a:prop>

< d:customerid> 1049306< / d:customerid>

< e:professioncode b:dt =" mv.string">

< c:v> byggtapetserarbeider< / c:v>

< c:v> malerarbeider< / c:v>

< / e:professioncode>

< / a:prop>

< / a: propstat>

< / a:响应>


我想显示这个分隔符并且有这个xsl:

<?xml version =" 1.0"?>

< xsl:stylesheet version =" 1.0"

xmlns:xsl =" http: //www.w3.org/1999/XSL/Transform">

< xsl:output method =" text" />

< xsl:模板

xmlns:a =" DAV:" ;

xmlns:d =" urn:schemas:contacts:"

xmlns:e =" cln-ewa:custom:"

xmlns:f =" cln-ewa:standard:"

match =" /">

< xsl:for-each select =" a:multistatus / a:response">

< xsl:value-of select =" a:propstat / a:prop / d:customerid" />

< xsl:text> < / xsl:text>

< xsl:for-each select =" a:propstat / a:prop / f:professioncode / c:v">

< xsl:value-of select =" concat(。,'','')" />

< / xsl:for-each>

< xsl:text>\r
< / xsl:text>

< / xsl:for-each>

< / xsl:template>

< / xsl:stylesheet>


获取customerid没有问题,但是没有for-each

专业代码总是以单个字符串形式出现,没有像

这样的分离:


byggtapetserarbeidermalerarbeider,


使用for-each和for-each我收到此错误:

msxml4.dll:引用未声明的命名空间前缀:''c''。


我哪里错了?


-

_________________

Rolf @ Questus ans

I have an xml with records like this one:

<a:response>
<a:href>http://server/public/sol/comp/1049306.eml</a:href>
<a:propstat>
<a:status>HTTP/1.1 200 OK</a:status>
<a:prop>
<d:customerid>1049306</d:customerid>
<e:professioncode b:dt="mv.string">
<c:v>byggtapetserarbeider</c:v>
<c:v>malerarbeider</c:v>
</e:professioncode>
</a:prop>
</a:propstat>
</a:response>

I want to display this tab-separated and have this xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template
xmlns:a="DAV:"
xmlns:d="urn:schemas:contacts:"
xmlns:e="cln-ewa:custom:"
xmlns:f="cln-ewa:standard:"
match="/">
<xsl:for-each select="a:multistatus/a:response">
<xsl:value-of select="a:propstat/a:prop/d:customerid"/>
<xsl:text> </xsl:text>
<xsl:for-each select="a:propstat/a:prop/f:professioncode/c:v">
<xsl:value-of select="concat(., '','')" />
</xsl:for-each>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

I have no problem getting the customerid, but without a "for-each" the
professioncode always comes out as a single string with no separation like
this:

byggtapetserarbeidermalerarbeider,

With the "for-each" I get this error:
msxml4.dll: Reference to undeclared namespace prefix: ''c''.

Where am I going wrong?

--
_________________
Rolf @ Questus ans

推荐答案




临时17:38:45,死于公元2005年7月28日星期四,hin in foro {comp.text.xml} scripsit Rolf Barbakken< no *** ***@alexandria.cc>:
Hi,

Tempore 17:38:45, die Thursday 28 July 2005 AD, hinc in foro {comp.text.xml} scripsit Rolf Barbakken <no******@alexandria.cc>:
使用for-each和for-each我收到此错误:
msxml4.dll:引用未声明的命名空间前缀:''c''。

我哪里错了?
With the "for-each" I get this error:
msxml4.dll: Reference to undeclared namespace prefix: ''c''.

Where am I going wrong?



错误消息是全部:您正在尝试访问元素c:v。但是你并没有声明带有c的命名空间。只需添加正确的xmlns:c即可。归属于xsl:value-of的祖先或自我。
问候,

-

Joris Gillis /users.telenet.be/root-jg/me.htmltarget =_ blank> http://users.telenet.be/root-jg/me.html )

Vincit omnia simplicitas

保持简单


The error message sais it all: you''re trying to access an element "c:v" but you didn''t declare the namespace that goes with "c". Just add the correct "xmlns:c" attribute to an ancestor-or-self of the "xsl:value-of" element.

regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Vincit omnia simplicitas
Keep it simple


" Joris Gillis" < RO ** @ pandora.be>在消息中写道

news:op *************** @ news.pandora.be ...
"Joris Gillis" <ro**@pandora.be> wrote in message
news:op***************@news.pandora.be...

{comp.text.xml} scripsit Rolf Barbakken< no ****** @ alexandria.cc> ;:
Hi,

Tempore 17:38:45, die Thursday 28 July 2005 AD, hinc in foro
{comp.text.xml} scripsit Rolf Barbakken <no******@alexandria.cc>:
使用for-each和for-each。我收到此错误:
msxml4.dll:引用未声明的命名空间前缀:''c''。

我哪里错了?
With the "for-each" I get this error:
msxml4.dll: Reference to undeclared namespace prefix: ''c''.

Where am I going wrong?


错误消息这就是全部:你试图访问一个元素c:v
但你并没有声明带有c的命名空间。只需添加
正确的xmlns:c即可。属于xsl:value-of
元素的祖先或自我。


The error message sais it all: you''re trying to access an element "c:v"
but you didn''t declare the namespace that goes with "c". Just add the
correct "xmlns:c" attribute to an ancestor-or-self of the "xsl:value-of"
element.




我也这么认为,所以我试过了/>

xmlns:c =" c:"





< xsl:for -each select =" a:propstat / a:prop / f:professioncode / c:v">

< xsl:value-of select =" concat(。,'', '')" />

< / xsl:for-each>


这是对的吗?


使用这段代码我比以前更少(根本没有专业代码),但

没有错误。


-

_________________

Rolf @ Questus ans



I thought so too, so I tried

xmlns:c="c:"

and

<xsl:for-each select="a:propstat/a:prop/f:professioncode/c:v">
<xsl:value-of select="concat(., '','')"/>
</xsl:for-each>

Is this right?

With this code I get even less than before (no professioncodes at all), but
no error.

--
_________________
Rolf @ Questus ans


Tempore 20:54:06,死于2005年7月28日星期四,在foro {comp .text.xml} scripsit Rolf Barbakken< no ****** @ alexandria.cc>:
Tempore 20:54:06, die Thursday 28 July 2005 AD, hinc in foro {comp.text.xml} scripsit Rolf Barbakken <no******@alexandria.cc>:
错误信息是全部:你试图访问一个元素c:v
但你并没有声明与c一起使用的e命名空间。只需添加
正确的xmlns:c即可。归属于xsl:value-of
元素的祖先或自我。
The error message sais it all: you''re trying to access an element "c:v"
but you didn''t declare the namespace that goes with "c". Just add the
correct "xmlns:c" attribute to an ancestor-or-self of the "xsl:value-of"
element.



我也这么认为,所以我试过了

xmlns:c =" c:"



I thought so too, so I tried

xmlns:c="c:"




显然,namespace-uri(引号之间)必须与在声明中声明的名称相同源XML;它不是虚拟数据。 " C:"是一个非常不可能的uri ...

问候,

-

Joris Gillis( http://users.telenet.be/root-jg/me.html

Vincit omnia simplicitas

保持简单



Obviously, the namespace-uri (between the quotes) has to be the same as the one declared in the source XML; it is not dummy data. "c:" is a very unlikely uri...
regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Vincit omnia simplicitas
Keep it simple


这篇关于xsl用于多值字符串的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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