2017-10-07 82 views
0

我想知道如何檢索「主管」中的URL以將其用作鏈接。我有這個XML文件。如何從XML元素檢索屬性的值

<pr> 
<meta> 
    <id>AAAAAAAAAAAA</id> 
    <title>AAAAAAAA</title> 
    <subtitle>BBBBB</subtitle> 
    <bdate>OCCCCCCCC</bdate> 
    <edate>DDDDDDDDDD</edate> 
    <supervisor url="http://wwww.teacherwWEbpage.com">teacher NAME 
</meta> 
</pr> 
</meta> 
<team> 
    <student> 
     <name>Rhghfghf</name> 
     <nr>fghfgh5</nr> 
     <email>hgghfht</email> 
    </student> 
</team> 
<abstract> 
</abstract> 
<deliverables> 
    <deliverable url="."></deliverable> 
</deliverables> 

這XSL,即時試圖把桌子上,這是很好的XML信息,但現在我無法設置教師名稱作爲URL的鏈接地址屬性...

如何將該屬性用作生成的HTML文件的鏈接?

</supervisor> 
</meta> 
<team> 
    <student> 
     <name>hrhshs</name> 
     <nr>48648</nr> 

    <xsl:template match="/"> 
    <html> 
     <head> 
      <meta charset="UTF-8"></meta> 
     </head> 
     <body> 
      <h1 align="center"> Projecto Record</h1> 
      <xsl:apply-templates/> 
     </body> 
    </html> 
</xsl:template> 

<xsl:template match="meta"> 
    <table> 
     <tr > 
      <td width="50%"><b>name key:</b><xsl:value-of select="id"/></td> 
      <td><b>Begin date:</b><xsl:value-of select="bdate"/></td> 
     </tr> 
     <tr> 
      <td><b>Title:</b><xsl:value-of select="title"/></td> 
      <td><b>End date:</b><xsl:value-of select="edate"/></td> 
     </tr> 
     <tr> 
      <td><b>Subtitle:</b><xsl:value-of select="subtitle"/></td> 
      <td><b>Supervisor:</b><a href="./supervisor/{@url}" ><xsl:value-of select="supervisor"/> </a></td> 
     </tr> 

    </table> 
</xsl:template> 

回答

0

您已經爲時不遠了與當前的嘗試,但你想要的語法是這樣的......

<a href="{supervisor/@url}" >