找一个子参数等于变量XSL

时间:2012-10-20 20:06:22

标签: xslt

我需要得到这个:

<a href="departments/CHEM.html">Chemistry and Chemical Biology</a>

我尝试使用此代码:

<a href="departments/{department/@code}.html">

但结果我得到了<a href="departments/.html">Chemistry and Chemical Biology</a>

这是我的xml

<fas_courses>
   <course acad_year="2012" cat_num="5085" offered="Y">
      <term term_pattern_code="1" fall_term="Y" spring_term="N">fall term</term>
      <department code="CHEM">
         <dept_long_name>Department of Chemistry and Chemical Biology</dept_long_name>
         <dept_short_name>Chemistry and Chemical Biology</dept_short_name>
      </department>
      <course_group code="CHEM">Chemistry</course_group>

我该如何解决? 提前谢谢!

1 个答案:

答案 0 :(得分:0)

我认为您需要使用部门的完整路径:

<a href="departments/{fas_courses/course/department/@code}.html">

如果有多个节点,则需要使用索引来获取特定节点或循环以获取每个节点。