Re: [xml] xml find and replace



Noam Postavsky schrieb am 19.07.2012 um 10:18 (-0400):

  <xsl:template match='//control[name="MatGrp1Ch1Pend"]/enum'>

Actually, using the descendant axis (//) like above is redundant and
misleading. It is equivalent to just "control[ â ]/enum". Why? Because
every <control> element node found is bound to be a descendant of the
current document.

Specifying the descendant axis here doesn't have an effect on whether
or not a search is performed.

The two things not to conflate here are *select expressions* and
*match patterns*.

  The syntax for patterns is a subset of the syntax for expressions.

http://www.w3.org/TR/xslt#patterns

The idea is that search expressions may be arbitrarily complex while
match patterns are confined to a subset that will allow you to easily
state whether a given node matches or doesn't.

In a nutshell: Keep match patterns simple.

Michael



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]