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

  • 主题发起人 主题发起人 spartak
  • 开始时间 开始时间
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

G
回复
4
查看
334
geng7758
G
H
回复
3
查看
380
honestman
H
X
回复
3
查看
289
gamebill
G
后退
顶部