Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <xsl:template
- match="//*[contains(@*:default,'instance(''document'')/')
- mode="pass">
- <xsl:variable
- name="regex"
- as="element()*">
- <regex>instance('document')/doc_type/description</regex>
- <regex>anotherRegex</regex>
- </xsl:variable>
- <xsl:variable
- name="replacement"
- as="element()*">
- <replacement>xxf:get-request-parameter('documentDesc')</replacement>
- <replacement>replacedRegex</replacement>
- </xsl:variable>
- <xsl:element name="{name()}">
- <xsl:for-each select="@*">
- <xsl:choose>
- <xsl:when test="name() = ('xxf:default')">
- <xsl:attribute name="xxf:default">
- <xsl:analyze-string
- regex="{concat('(',$regex[1],'|',$regex[2],')')}"
- select=".">
- <xsl:matching-substring>
- <xsl:if test="matches(.,$regex[1])">
- <xsl:value-of select="replace(.,$regex[1],$replacement[1])" />
- </xsl:if>
- <xsl:if test="matches(.,$regex[2])">
- <xsl:value-of select="replace(.,$regex[2],$replacement[2])" />
- </xsl:if>
- </xsl:matching-substring>
- <xsl:non-matching-substring>
- <xsl:value-of select="." />
- </xsl:non-matching-substring>
- </xsl:analyze-string>
- </xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="{local-name()}"><xsl:value-of select="." /></xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:element>
- </xsl:template>
- <xf:bind id="clinic-bind"
- name="clinic"
- xxf:default="instance('document')/doc_type/description"
- type="xf:string"/>
- <xf:bind id="clinic-bind"
- name="clinic"
- xxf:default="xxf:get-request-parameter('documentDesc')"
- type="xf:string"/>
Add Comment
Please, Sign In to add comment