Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Match an attribute value in a set of possible values

From: Joseph Kesselman <keshlam-nospam@-------.--->
To: 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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent