2014-03-02 44 views
0

所以,我試圖找出如何從一個模板XSL - 如何從模板中調用全局參數名稱?

<?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> 

調用一個定義PARAM名在參數名「小時」我已經給它的「3」的值,對此我希望是凌晨3點。我的最終目標是每天延遲發送到'server4'到凌晨3點,我想我可以通過使用已經提供的全局參數來實現。服務器1,2,& 3立即收到正確工作。

我打這個電話是嗎?

感謝您的期待和所有的幫助!

回答

2

它應該是:select="$hour"

+2

它是一個帶有文字屬性的文字結果元素,因此需要使用屬性值模板''。 –

相關問題