xsl得到原子场

时间:2016-06-22 16:10:16

标签: xslt xslt-1.0 xslt-2.0 atom-feed

这是我的xsl之后标题我需要从xml以下显示VacancyID你能不能帮助我如何获得这个值

无法访问xsl中的atom-field 需要帮助解决这个问题

<?xml version="1.0" encoding="utf-8"?>
    <rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0">
       <channel>
           <title>abc</title>
           <link>https://google.com</link>
           <description>test</description>
           <item>
               <link>https://google.com</link>
               <title>abc</title>
               <a10:updated>2016-06-22T10:44:49Z</a10:updated>
               <a10:content type="text/xml">
                   <Vacancy>
                       <VacancyID>123</VacancyID>                
                   </Vacancy>
               </a10:content>
            </item>
       </channel>
    </rss>


    xsl:

    THIS IS MY xsl  after Title i need to display VacancyID from ablove xml can you any help me how to get this valu

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom">   
      <xsl:output omit-xml-declaration="yes" indent="no"/>
      <xsl:template match="/">
        <div id="press-release">
            <xsl:apply-templates select="rss/channel/item"/>
        </div> 
      </xsl:template>

      <xsl:template match="item">
        <div class="press-item">
          <a href="{./link}" target="_blank" class="title" title="{./title}">
            <xsl:value-of select="./title" disable-output-escaping="yes" />     
            vacancyID????????????(need heleher)
          </a>
          <xsl:template match="atom:content">

1 个答案:

答案 0 :(得分:1)

在匹配item的模板中,您可以使用:

<xsl:value-of select="atom:content/Vacancy/VacancyID"  />

获取VacancyID的值。