XSL - 如何从模板中调用全局参数名称?

时间:2014-03-02 10:00:57

标签: templates xslt param

所以,我正在试图弄清楚如何从模板中调用已定义的参数名称

    <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml"/>

  <!--
   The following parameters are made available by the application:
   source-aet   - AET of the Storage SCU from which the series was received
   retrieve-aet - AET of the Query Retrieve SCP from which the series can be retrieved
   year  - The current year
   month - The current month (1=Jan, 2=Feb ..)
   date  - The current day of the month
   day   - The current day of the week (0=Sun, 1=Mon ..)
   hour  - The current hour of the day

   These parameters may be to define rules that depend on the source or retrieve AET
   or on the current date or time.

   An example of the parameters that are made available to this stylesheet is as follows:
   <xsl:param name="source-aet">DCMSND</xsl:param>
   <xsl:param name="retrieve-aet">SERVERAET</xsl:param>
   <xsl:param name="month">4</xsl:param>
   <xsl:param name="date">30</xsl:param>
   <xsl:param name="day">1</xsl:param>
   <xsl:param name="hour">15</xsl:param>
  -->
  <xsl:param name="source-aet"/>
  <xsl:param name="retrieve-aet"/>
  <xsl:param name="year"/>
  <xsl:param name="month"/>
  <xsl:param name="date"/>
  <xsl:param name="day"/>
  <xsl:param name="hour">3</xsl:param>

 <xsl:template match="/dataset">
    <!-- forward CATH LAB Studies EVERYWHERE -->
    <xsl:variable name="Station" select="attr[@tag='00081010']"/>
    <xsl:variable name="MOD" select="attr[@tag='00080060']"/>
      <xsl:if test="contains($Station,'J')">
        <xsl:if test="$MOD='XA'">
          <destination aet="SERVER1"/>
          <destination aet="SERVER2"/>
          <destination aet="SERVER3"/>
          <destination aet="SERVER4" select="hour"/>
          </xsl:if>
      </xsl:if>
 </xsl:template>
</xsl:stylesheet>

在参数名称“小时”中,我给它的值为'3',我希望它是凌晨3点。我的最终目标是将发送“延迟”到'server4',直到每天凌晨3点,我想我可以通过使用已经提供的全局参数来实现。服务器1,2和&amp; 3立即收到正常工作。

我是这样称呼的吗?

感谢您的期待和所有帮助!

1 个答案:

答案 0 :(得分:2)

应该是:select="$hour"