How to apply or link several suitable templates in XSLT?

I am working on a stylesheet using many templates with matching attributes:

<xsl:template match="//one" priority="0.7">
   <xsl:param name="input" select="."/>
   <xsl:value-of select="util:uppercase($input)"/>
   <xsl:next-match />
</xsl:template>

<xsl:template match="/stuff/one">
    <xsl:param name="input" select="."/>
    <xsl:value-of select="util:add-period($input)"/>
</xsl:template>

<xsl:function name="util:uppercase">
    <xsl:param name="input"/>
    <xsl:value-of select="upper-case($input)"/>
</xsl:function>

<xsl:function name="util:add-period">
    <xsl:param name="input"/>
    <xsl:value-of select="concat($input,'.')"/>
</xsl:function>

What I would like to do is “link” the two functions above so that the input of the “string” will be displayed as “STRING”. (with a period.) I would like to do this in such a way as not to require knowledge of other patterns in any other pattern. So, for example, I would like to be able to add the util: add-color method without opening the hood and monkey with existing templates.

<xsl:next-match/>, . , , : uppercase util: add-period, (, "STRINGstring." ). , , - <xsl:next-match/>, . - ?

+3
1

, template1 xsl:variable, template2 xsl:.

:

util:add-period(util:uppercase(.))

, , util:add-period():

<xsl:function name="util:add-period" as="xs:string">  
    <xsl:text>.</xsl:text>  
</xsl:function>
+3

Source: https://habr.com/ru/post/1744562/


All Articles