Subject: RE: [xsl] Force the case of a set of strings From: "Kerry, Richard" <richard.kerry@xxxxxxxx> Date: Tue, 30 Oct 2012 12:13:57 +0000 |
> >I have a sequence of strings which are all 'ok' or 'fail' where I > >want to force the case of all of them. > > Actually, it looks like you have a sequence of nodes in > $states, not strings. Ah yes. Actually I did know that (no really). I just didn't state It properly. > >Can anyone suggest how I might process my sequence to return a > >sequence but have each entry passed through lower-case. > > $states/lower-case(normalize-space(column[7])) Thank you, done that. Seems to be working. > I remind my students in class that the "/" in "$nodes/expr" is an > abbreviation for: > > for $n in $nodes return expr($n) > > ... which is exactly what you did in setting your first variable. I > just took it one step further. I realized I could get the column data via normalize-space. I just didn't spot that I could just add the lower-case there. > >I thought maybe I could pass it as a parameter to a moded > >apply-templates, but then I get warned that select needs a node, not > >a string, as its @select attribute. > > That shouldn't be necessary if the input is as simple as you imply. It wasn't, and it is. > >Subsequently I do distinct-values on it and the result of that I > >want only to contain 'ok' or 'fail', with no case variations > remaining. > > The sequence above would be satisfactory input to distinct-values(). It was. > > I hope this helps. Very much so. XSLT is very much about how to look at what you've got. And especially about sequences. > . . . . . . . . . Ken Richard.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Force the case of a set o, G. Ken Holman | Thread | RE: [xsl] Force the case of a set o, G. Ken Holman |
Re: [xsl] [XPath 3.0] How to do par, Michael Kay | Date | RE: [xsl] Force the case of a set o, G. Ken Holman |
Month |