200分求解入门级问题。(about xsl)(200分)

S

spartak

Unregistered / Unconfirmed
GUEST, unregistred user!
xml中有这样一堆文字
<txt>
.
.
.
<content>
第一行第一行第一行第一行第一行<br/>第二行第二行第二行第二行第二行第二行
</content>
</txt>
xsl中怎样让<br>起作用?
<xsl:for-each select="txt">
<p><xsl:value-of select="content"/></p>
</xsl:for-each>
注:(namespace是 http://www.w3.org/TR/WD-xsl)
如果有其他解决方法不在xml文件的内容里加br也可
谢谢
 
你要在XSL中用<br/>,
不是在XML中用<br/>,这样你的XML不是完整格式化的.
请参考.
http://www.delphibbs.com/delphibbs/modifyl.asp?lid=684694
http://www.delphibbs.com/delphibbs/modifyl.asp?lid=684741
http://www.delphibbs.com/delphibbs/modifyl.asp?lid=684753
http://www.delphibbs.com/delphibbs/modifyl.asp?lid=686879
http://www.delphibbs.com/delphibbs/modifyl.asp?lid=686895
http://www.delphibbs.com/delphibbs/modifyl.asp?lid=686920
http://www.delphibbs.com/delphibbs/modifyl.asp?lid=695403
http://www.delphibbs.com/delphibbs/modifyl.asp?lid=695421
http://www.delphibbs.com/delphibbs/modifyl.asp?lid=695431
 
一段文字,在xml里总得标记在那里换行吧,要不然xsl怎么识别它?
 
<name>
<![CDATA[第一行
第二行
]]>
</name>
 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html><body>
<xsl:for-each select="txt">
<xsl:apply-templates select="content" />
</xsl:for-each>
</body></html>
</xsl:template>
<xsl:template match="content">
<xsl:apply-templates select="textnode()|*" />
</xsl:template>
<xsl:template match="textnode()">
<xsl:value-of select="." />
</xsl:template>

<xsl:template match="br">
<br />
</xsl:template>
</xsl:stylesheet>
 
这里太萧条了,是不是有人在csdn看到了?
 
faint,我把顺序搞颠倒了,能不能重新结算分数阿。
应该是dongberlin-20,xmiao-180,
 
:(
真是的,这也弄错了,5555~~~~~~~~~~~我的分啊,呵呵
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
678
import
I
I
回复
0
查看
738
import
I
I
回复
0
查看
716
import
I
顶部