RE: [xsl] Tokenized values

Subject: RE: [xsl] Tokenized values
From: Michael Brennan <Michael_Brennan@xxxxxxxxxxx>
Date: Wed, 25 Jul 2001 11:39:27 -0700

> -----Original Message-----
> From: Jeni Tennison [mailto:mail@xxxxxxxxxxxxxxxx]
> Sent: Wednesday, July 25, 2001 2:58 AM
> To: Adam Van Den Hoven
> Cc: XSL Mailing List (E-mail)
> Subject: Re: [xsl] Tokenized values
> 
> 
> Hi Adam,
> 
> > According to the XML Spec there are several tokenized types (IDREFS,
> > ENTITIES, NMTOKENS
> > http://www.w3.org/TR/2000/WD-xml-2e-20000814#NT-TokenizedType) which
> > are valid for attribute values. How would one handle these values in
> > XSL? I'm in the middle of building a recursive named template to
> > parse out the values but then when I'm done, all I get is a series
> > of result trees.
> >
> > Is there a reason why XSL doesn't include something like
> >
> > <xsl:variable name="values" select="split(@something)" /> 
> > <xsl:apply-templates select="$values/text()" />
> >
> > It seems that since this functionality handles a common XML
> > situation (the HTML class attribute), this should be built in to XSL
> > and not an extention.
> 
> In the XML Schema world these are known as list data types.
> Requirement 4.4 of XPath 2.0 reads:
> 
>   4.4 Should Add List Data Type to the Type System of the Expression
>   Language
> 
>   XML Schema allows the definition of simple types derived by list,
>   including lists of unions of non-list simple types. XPath 2.0 SHOULD
>   support an ordered list of simple-typed values.
> 
> So you can probably expect support for handling these kinds of things
> with a function come XPath 2.0/XSLT 2.0.
> 
> In the short term, there is one function that may help, namely the
> id() function, which can take a space-separated string and locate the
> elements with those IDs in a document. However you have to jump
> through some hoops to use it in any useful way, and it's often easier
> to use an extension function (e.g. exsl:tokenize(), saxon:tokenize(),
> xalan:tokenize()) or write a recursive template that either acts on
> each of the values as it finds them or returns a result tree fragment
> that you convert to a node set using a node-set extension function
> (you can use the one at
> http://www.exslt.org/str/functions/tokenize/str.tokenize.template.xsl
> if you like).
> 
> Cheers,
> 
> Jeni
> 
> ---
> Jeni Tennison
> http://www.jenitennison.com/
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread