Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: Match an attribute value in a set of possible values [Thread Next] Re: Match an attribute value in a set of possible valuesTo: NULL Date: 9/1/2006 10:56:00 AM
patrin wrote:
> setParameter("idsToRemove", idsToRemove);
Well, you're unlikely to be able to pass in an array of strings and do
anything useful with it except (maybe) pass it back out to an extension
function. Xalan, for example, will treat that as a "non-XSLT type".
I'd suggest reformatting the data as a single string, which most
processors should treat as an XSLT string value, and then doing string
manipulation to check if the ID is contained in that list. I did a
quick-and-dirty version of that in my styling-stylesheets article; since
it was just an illustration I didn't make it highly robust but you could
make it stronger by checking delimiters.
Alternatively, some processors (again, Xalan is one of these) may let
you pass in a DOM node and have XSLT treat it as a node-set. If you
construct a tree where one element has each of the values, you could
then do an XSLT node-set comparison (does any node in one set equal any
node in the other set). The stylesheet would be cleaner, but the
preparation would be more complex. I'm not sure how portable this
approach would be; the TrAX APIs don't make any particular promises
about how non-string parameters will be processed.
Alternatively: Build that nodes-I'm-interested-in XML document as text,
and put it somewhere that the stylesheet can access via the document()
function. Less efficient, but it gives you the simple "does anything
equal" syntax in the stylesheet, and it may be more portable than
relying on the API to do something useful with Nodes.
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
