Altova Mailing List Archives


Re: Re: [xsl] Thought i knew this but i guess not

From: russurquhart1@-------.---
To: xsl-list@-----.------------.---
Date: 2/22/2011 9:56:00 PM

Thank you Wendell, i think i have my head around it now. I found some code and will also look at what you've suggested.

I know the test is kind of shaky, and will probably need something better. The filter value can be of a form filter="filter1,filter10, filter17, filter23" something like that, so i need to do a little more testing.

Thanks again!


Russ

Feb 22, 2011 09:44:10 PM, xsl-list@l... wrote:

Russ,

You are almost there.

First, you want xsl:apply-templates, not xsl:value-of. 
xsl:apply-templates will continue template matching through the tree. 
xsl:value-of will write the string value of the element, without 
processing children with templates.

Second, don't forget to do the usual xsl:copy thing for the elements you 
don't want to filter out.

Then, I suggest you might invert your logic for clarity.

Something like this?


   
     
       
         
       
     
     
   


This, of course, easily reduces to an xsl:if.

If that doesn't do it, maybe making a minimal test sample for 
demonstration would help.

Finally, I note that your test for your filter is brittle. 
@filter='filter11' will pass. (And 'filter10' will pass for two 
reasons.) The best fix to this depends on how you are using @filter.

Cheers,
Wendell

On 2/22/2011 3:38 PM, russurquhart1@v... wrote:
> Hi Everyone,
>
> I just can't get this today. (Maybe i need more sleep.)
>
> I have the following, trying to follow Wendell'sadvice:
>
> 
>    
>      
>        
>      
>    
>    
>      
>        
>        
>        
>          
>        
>      
>    
>
> 
>
> I want this to work kind of like a conditional text thing. When i run this i get NO elements with a filtered attribute.
>
> Little more help for the slow kid? :)
>
> thanks,
>
>
> Russ
> Feb 22, 2011 07:35:48 PM, xsl-list@l... wrote:
-- 
======================================================================
Wendell Piez                            mailto:wapiez@m...
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
   Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@l...>
--~--

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.