Subject: [xsl] Re: problem with fn:contains using xsl:param From: Piotr Dobrogost <pd@xxxxxxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 15 Dec 2009 01:12:02 +0100 |
Date: Sun, 13 Dec 2009 17:40:44 -0500 From: "G. Ken Holman"<gkholman@xxxxxxxxxxxxxxxxxxxx> Message-Id:<7.0.1.0.2.20091213172539.025d5598@xxxxxxxxxxxxxxxxxxxxxx>
First "xsd:bool" is incomplete and would have to be "xsd:boolean".
And while it won't affect this particular example, the "protected" way of doing what you are doing with strings is to add a space at the start and end of your string with the tokens, and then add a space to the start and end of the token being searched.
In XSLT 2 you might consider something like:
<xsl:param name="KnownXSDTypes" as="element()*"> <type>xsd:date</type> <type>xsd:dateTime</type> <type>xsd:boolean</type> </xsl:param> ... <xsl:template match="xsd:element[@type=$KnownXSDTypes]">
<xsl:template name="KeyToValue"> <xsl:param name="map"/> <xsl:param name="key"/> <xsl:analyze-string select="$map" regex="([^\s]+)/([^\s]+)"> <xsl:matching-substring> <xsl:if test="regex-group(1) eq $key"> <xsl:value-of select="regex-group(2)"/> </xsl:if> </xsl:matching-substring> </xsl:analyze-string> </xsl:template>
<map> <entry key='foo' value='bar'/> (...) </map>
Regards Piotr Dobrogost
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xslt task in Ant: the cla, Dave Pawson | Thread | Re: [xsl] Re: problem with fn:conta, G. Ken Holman |
Re: [xsl] xslt task in Ant: the cla, Dave Pawson | Date | Re: [xsl] problem with fn:contains , Piotr Dobrogost |
Month |