佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

搜索
查看: 943|回复: 2

XSL Document()

[复制链接]
发表于 15-4-2009 04:03 PM | 显示全部楼层 |阅读模式
小弟有三个 xml
每个都拥有一样的结构

EXAMPLE:
  1. <?xml version="1.0"?>
  2. <train>
  3.        <customer>A</customer>
  4.        <bus no="BC1243">
  5.             <date>12-12-2009</date>
  6.             <seat>24A</seat>
  7.        </bus>
  8. </train>

  9. <train>
  10.        <customer>B</customer>
  11.        <bus no="BC1243">
  12.             <date>12-12-2009</date>
  13.             <seat>24B</seat>
  14.        </bus>
  15. </train>
复制代码
请问怎样在 xsl 运用 document() query 这三个xml date,然后 apply-templates ?
回复

使用道具 举报


ADVERTISEMENT

发表于 19-5-2009 02:41 PM | 显示全部楼层
你的xml 有点错。
------------------------xml ---------------------------------
<?xml version="1.0"?>
<test>
<train>
       <customer>A</customer>
       <bus no="BC1243">
            <date>12-12-2009</date>
            <seat>24A</seat>
       </bus>
</train>
<train>
       <customer>B</customer>
       <bus no="BC1243">
            <date>12-12-2009</date>
            <seat>24B</seat>
       </bus>
</train>
</test>
--------------------------------------------------------------------------------------

---------------------------XSL-------------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="html" omit-xml-declaration="yes"/>
<xsl:for-each select="/">
       
                 script....................
       
</xsl:for-each >

<xsl:template match="/test/train/bus/date">
     <xsl:value-of select="."/>
</xsl:template>
---------------------------------------------------------------------------------
回复

使用道具 举报

发表于 19-5-2009 02:48 PM | 显示全部楼层
对不起,这才是正确的答案.

------------------------xml ---------------------------------
<?xml version="1.0"?>
<test>
<train>
       <customer>A</customer>
       <bus no="BC1243">
            <date>12-12-2009</date>
            <seat>24A</seat>
       </bus>
</train>
<train>
       <customer>B</customer>
       <bus no="BC1243">
            <date>12-12-2009</date>
            <seat>24B</seat>
       </bus>
</train>
</test>
--------------------------------------------------------------------------------------

---------------------------XSL-------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy&#174; -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  
  <xsl:apply-templates/>  
  
</xsl:template>

<xsl:template match="/test/train/bus/date">
  <p>
    <xsl:value-of select="."/>
  </p>
</xsl:template>
</xsl:stylesheet>
---------------------------------------------------------------------------------
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2026 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 27-4-2026 08:54 PM , Processed in 0.073775 second(s), 12 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表