Re: [xsl] problem with fn:contains using xsl:param

Subject: Re: [xsl] problem with fn:contains using xsl:param
From: Piotr Dobrogost <pd@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 Dec 2009 01:34:20 +0100
Date: Sun, 13 Dec 2009 23:06:28 -0000
From: "Michael Kay"<mike@xxxxxxxxxxxx>
Subject: RE: [xsl] problem with fn:contains using xsl:param
Message-ID:<909EFC046E7147B487D950129EBA61F4@Sealion>

(a) your code shouldn't be sensitive to the choice of prefixes used in the
source document (especially the xsd prefix, where half the community uses
"xsd" and the other half uses "xs")

I agree with you as I'm obsessed with universal solutions but it's not going to be one of them and namespace's prefix is well defined (xsd) and won't change.


(b) there are better ways of testing whether a value is one of a given list
of values:

That's what I was hoping to hear on this list and I'm very glad to hear this.


<xsl:param name="KnownXSDTypes" as="xsd:QName*"
   select="(xsd:QName('xsd:date'), xsd:QName('xsd:dateTime'),
xsd:QName('xsd:boolean')"/>

<xsl:template match="xsd:element[QName(@type, .) = $KnownXSDTypes">

How is this one different from Ken's proposal?
It does not seem to solve (a), does it?
Could you please comment on how to go about creating a map and using it to solve (b) and to map attribute's name to some string?


(With a schema-aware stylesheet, of course, you wouldn't have to do all the
explicit casting, this would be done automatically in the course of schema
validation).

Sorry for my lame question (I've only read XSLT 1.0 specification not 2.0) but what do you mean by schema-aware stylesheet? I guess that schema-aware stylesheet has knowledge about schema of xml document it translates. If it's so then someone would first have to create schema for our schema as my xsl translates _schema_ to Perl code :)



Regards Piotr Dobrogost

Current Thread