Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] returning nodes which have a specific child

From: Michael Ludwig <mlu@---------.--->
To: xsl-list@-----.------------.---
Date: 7/2/2009 10:15:00 AM
Michael Kay schrieb:

> I would have given the rules explicit priorities of 1, 2, and 3
> respectively to make this more readable.

I agree this can help to make it more readable. But it depends on the
reader. I rarely assign priorities, because when adding more rules, I
then have to remember my hand-crafted priority matrix, which may be
different each time around, whereas the default priorities are stable.

> Michael has also taken a short-cut in that Rule 1 is a very commonly
> used "default rule" called the identity template, so he has re-used
> it; but in your case it's never used for element nodes, so it could be
> replaced by the simpler rule
>
>   <xsl:template match="@*">
>     <xsl:copy/>
>   </xsl:template>

That's true. But I like to see an identity template around, as a backup
and safety net, so to say, against changes I may make. I think the
identity template would have been a useful default rule.

http://markmail.org/message/xmqxvbxdzewbeyhu
http://markmail.org/message/o4ceperr4svpffr5

> (I'm not sure why rule 3 is processing the attributes of an element
> and rule 2 isn't, but I didn't study your original problem.)

In rule 2, I only want to keep the recursion alive, deilberately losing
all attributes and non-element children, so I don't <apply-templates> to
them.

Michael Ludwig

--~------------------------------------------------------------------
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...>
--~--



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