开发者

Dealing with empty XML in XSLT

开发者 https://www.devze.com 2022-12-08 00:15 出处:网络
I\'m using XSLT to return some values, output as XHTML. However I usually structure my XSL like this:

I'm using XSLT to return some values, output as XHTML. However I usually structure my XSL like this:

<div id="something">
  call template=Something
</div>

The trouble is when the XML returned is empty , it just outputs:

<div id="something">
Empty set.

And as you can imagine this screws up my page.

Is there any function I can use to detect if there is any data there or not? Or can anyone think of a better way of stopping this开发者_高级运维 from happening.


I think you may be using

<xsl:output method="html" />

try

<xsl:output method="xml" />

instead.


It's just a dirty hack, but I had the same problem and I was in a hurry, so I ended using

<div id="something">
    <span>call template=Something</span>
</div>
0

精彩评论

暂无评论...
验证码 换一张
取 消