奇怪的 pdf 生成器问题
带有破折号的 xml 标签是否有问题?
我正在尝试从 xsl 和 xml 生成 pdf。
例如,我有以下内容:
<car>
<name>toyotoa</name>
<color-value>green</color-value>
</car>
在我的 xsl 中,
<fo:inline font-weight="bold"> <xsl:value-of select="name" /> </fo:inline>
类似的内容会打印 pdf 中的正确值
如果我尝试打印第二个标签(颜色值),则 .. pdf 中没有打印任何内容.. 就好像它无法读取该节点一样。
<fo:inline font-weight="bold"> <xsl:value-of select="color-value" /> </fo:inline>
这不会返回任何内容。
但是,当我在 Eclipse 中进行测试并运行 xsl 作为 xsl 转换时。输出文件正确显示这两个值。只有在pdf中它只显示第一个。
关于可能发生的事情有任何线索吗?
编辑 我可以通过尝试列出汽车节点下标签的所有值来进行调试吗?也许这会给我一些提示。?
编辑2 看起来问题发生在速度模板而不是 xls
编辑 3 在检查了速度模板调用的用于生成汽车颜色值的方法后找到了解决方案。显然存在继承问题,并且该值甚至没有插入到 xml 中进行转换。
Is there a problem with xml tags that have a dash in them??
I am trying to generate a pdf from and xsl and an xml..
I have the following for example:
<car>
<name>toyotoa</name>
<color-value>green</color-value>
</car>
In my xsl I have something like
<fo:inline font-weight="bold"> <xsl:value-of select="name" /> </fo:inline>
this prints the correct value in the pdf
if I try to print the second tag (color-value) .. nothing is printed in the pdf.. as if it can't read that node.
<fo:inline font-weight="bold"> <xsl:value-of select="color-value" /> </fo:inline>
this returns nothing..
However when I do the test in eclipse and run the xsl as xsl tranformation .. the output file correctly displays both values. Only in the pdf does it only display the first one.
Any clues on what might be going on?
EDIT
Can I somehow debug by trying to list all the values of the tags under the car node? maybe that will give me some hints. ?
EDIT 2
Looks like the problem occurs at the velocity template not the xls
EDIT 3
found the solution after checking the method called by the velocity template for generating the value of car-color.. apparently there was an inheritence isssue and the value was not even inserted in the xml for the tranformation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果这不是完整的答案,我很抱歉,但在我看来,逃避可能是这里的问题。 XSLT 标准似乎表明, select 属性的值是一个表达式,可能会将破折号视为减法(如元素颜色值减去元素值的值)。但我不知道如何解决这个问题。
I'm sorry if this is not a complete answer, but it seems to me, that escaping might be the issue here. The XSLT standard seems to suggest, that the value of the select attribute is an expression, that might see the dash as a subtraction (as in value of the element color minus the value of the element value). I have no idea though, how to fix this.
您需要关闭第二个示例中的 select 属性。
you need to close the select attribute in the second example.