带名称空间的XML文件XSL转换

源XML文件:
<?xml version="1.0"?>
<
staff xmlns="urn:hl7-org:v3">
    <employee>
        <name>AAA</name>
        <salary>111</salary>
        <date>1981</date>
    </employee>
    <employee>
        <name>BBB</name>
        <salary>222</salary>
        <date>1982</date>
    </employee>
<
/staff>

XSL文件:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:HL7="urn:hl7-org:v3" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes"/>
<xsl:template match="/">
   <xsl:apply-templates select="node()">
</xsl:template>
<xsl:template match="HL7:employee">
    //TODO:
    ...
<xsl:template>
注意高亮的部分,我们必须定义名称空间这样才能匹配到XML文件中的相应节点。
posted @ 2009-09-10 10:51  Devilmsg  阅读(291)  评论(0编辑  收藏  举报