简体   繁体   English

XSL-FO | FO:标记已被删除

[英]XSL-FO | FO: Tags are being removed

I'm currently using XSL for a work project and I'm facing an issue. 我目前正在将XSL用于工作项目,但遇到了问题。

I'm trying to read values for a database that look like this: 我正在尝试读取如下所示的数据库值:

<fo:block font-weight='bold>hello</fo:block>

and it seems that XSL is stripping the <fo:block> element because it gives me text only ( I only see Hello, not in bold, and it doesn't behave like a block element ). 而且XSL似乎正在剥离<fo:block>元素,因为它仅给我提供了文本(我只看到Hello,而不是粗体,并且它的行为不像block元素)。 I feel like, somehow, that XSL interprets the value read from the DB as a string, and strip of the <fo> tags, leaving my with text only. 我觉得,以某种方式,XSL将从数据库读取的值解释为字符串和<fo>标记的条,而只留下文本。

Any idea what could be done in order that my styling get preserved? 知道如何做才能保留我的样式吗?

( Obviously this example have been simplified, the text to be displayed is longer than that ) (显然,此示例已简化,要显示的文本比该文本更长)

EDIT : Self answered for future references 编辑:自我回答,以备将来参考

根据您要更改的注释将<xsl:value-of select='/fulfill-list/ticket-list/list-item/eventTicketConte‌​nt/xmlTicketContent/‌​ticketdescription'/>更改为<xsl:copy-of select='/fulfill-list/ticket-list/list-item/eventTicketConte‌​nt/xmlTicketContent/‌​ticketdescription'/> (或<xsl:copy-of select='/fulfill-list/ticket-list/list-item/eventTicketConte‌​nt/xmlTicketContent/‌​ticketdescription/node()'/> )。

As first i wanted to thanks you all to have taken the time to answer me. 首先,我想感谢大家花时间回答我。 I'm very very very glad to see SO community is such strong. 看到SO社区如此强大,我感到非常非常高兴。

I have solved my problem this way : 我已经通过以下方式解决了我的问题:

 <xsl:for-each select="/fulfill-list/ticket-list/list-item/eventTicketContent/xmlTicketContent/ticketdescription/node()">
      <xsl:copy-of select="child::node()" />
    </xsl:for-each>

I don't really know what happened beneath the hood and why the <fo> tags were removed, but they were. 我真的不知道幕后到底发生了什么,以及为什么<fo>标签被删除了,但它们确实被删除了。 Looping through all of them and using <xsl:copy-of> did the trick. 遍历所有变量并使用<xsl:copy-of>达到目的。

Once again, a big thanks to y'all ! 再次感谢你们!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM