开发者

XSLT: How to pass a node value to a custom xsl:function ?

开发者 https://www.devze.com 2022-12-19 14:27 出处:网络
I have a simple function that I want to pass the value of a node to. <xsl:function name=\"f:getdatetimetype\" as=\"xs:string\">

I have a simple function that I want to pass the value of a node to.

   <xsl:function name="f:getdatetimetype" as="xs:string">
   <xs开发者_JAVA百科l:param name="code" as="xs:int"/>
   <xsl:choose>
      <xsl:when test="$code = 137">
          <xsl:text>DocumentMessageDateTime</xsl:text>
      </xsl:when>
      <xsl:otherwise>
         <xsl:text>Unspecified</xsl:text>
      </xsl:otherwise>
  </xsl:choose>
</xsl:function>

How do I do that?

I don't suppose I can do like this:

<xsl:value-of select="f:getdatetimetype(<xsl:value-of select="DTM01/DTM0101"/>)"/>


You should go with

<xsl:value-of select="f:getdatetimetype(DTM01/DTM0101)"/>


Solved it:

<xsl:value-of select="f:getdatetimetype(DTM01/DTM0101/text())"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号