Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 9/1/2006 4:58:00 PM



patrin wrote:


> Thanks for the quick replay, but the list of ids to match is dynamyc
> and I know it only from Java code, where it is stored into a String
> arrray:
> 
> String[] idsToRemove = {1,3,...};
> 
> and I would like to pass it to the Transformer, invoking the method:
> 
> setParameter("idsToRemove", idsToRemove);
> 
> so that the XSLT should remove all the child elements whose test
> subelement has an id with any of the values contained in the
> idsToRemove array.
> 
> Is it possible to do this with XSLT 1.0 ? 

I guess there are two approaches, one that might be processor dependent 
where you need to look at the documentation of the XSLT processor what 
kind of types you can pass in with setParameter:

The setParameter method 
<http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/transform/Transformer.html#setParameter(java.lang.String,%20java.lang.Object)> 
as the second argument takes any object so it might well be that it 
works to pass in a Source (e.g. DOMSource or SAXSource or StreamSource) 
there as well. But details depend on the XSLT processor, I don't think I 
have tried that so far with Saxon or Xalan.


The second approach would take the XSLT stylesheet as an XML document 
and change it as needed depending on your idsToRemove before the 
stylesheet is used for the transformation.


-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Digg
delicious
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