您的位置:程序门 -> web 开发 -> xml/soap



xsl---xml 网页引用头文件


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


xsl---xml 网页引用头文件[已结贴,结贴人:54321790]
发表于:2007-11-19 15:54:07 楼主
小弟我用一个软件,自动生成网页,是xml的,通过更改其xsl文件,想引用一个头文件,试了几个方法都不行。该如何做那?小弟初学,多谢,多谢。
发表于:2007-11-19 19:52:221楼 得分:0
xml文件头部声明里不能采用变量,只能写死.

你可以采用服务器将xsl格式化xml后再输出.或者动态加载xml再输出一段声明信息再输出xml文档..
发表于:2007-11-20 10:23:112楼 得分:5
不怎么明白lz的意思
发表于:2007-11-22 20:07:343楼 得分:5
如果是引用文件的话可以用类似如下

<xsl:param   name="pagerecords">
<xsl:value-of   select="document('../xml/blog_settings.xml')"   />  
</xsl:param>

关键是document('xxx')
发表于:2007-11-29 16:42:204楼 得分:30
给你个例子
xml code
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="/"> <div> <xsl:for-each select="link_root/link"> <xsl:if test="@to='text'"> <a> <xsl:attribute name="href"> <xsl:value-of select="url"></xsl:value-of></xsl:attribute> <xsl:attribute name="alt"> <xsl:value-of select="title"/> </xsl:attribute> <xsl:attribute name="target"> <xsl:value-of select="target"/> </xsl:attribute> <xsl:value-of select="text"/> </a> <xsl:text>|</xsl:text> </xsl:if> </xsl:for-each> </div> <div> <xsl:for-each select="link_root/link"> <xsl:if test="@to='image'"> <a> <xsl:attribute name="href"> <xsl:value-of select="url"></xsl:value-of> </xsl:attribute> <xsl:attribute name="target"> <xsl:value-of select="target"/> </xsl:attribute> <img border="0" width="120" height="60"> <xsl:attribute name="src"> <xsl:value-of select="text"/> </xsl:attribute> <xsl:attribute name="alt"> <xsl:value-of select="title"/> </xsl:attribute> </img> </a> </xsl:if> </xsl:for-each> </div> </xsl:template> </xsl:stylesheet>


快速检索

最新资讯
热门点击