Re: p:viewport vs. p:delete

/ Alex Milowski <alex@milowski.org> was heard to say:
|> If it's a match pattern, how many other standard components use match
|> patterns?
|
| Steps that should use match:
|
|   p:replace
|
| Steps that could use either:
|
|   p:insert
|   p:wrap
|
| Steps that should use select:
|
|   p:rename
|
| My criteria being whether it makes sense for the step to
| operate on "inner matches" (nodes that are contained
| in other nodes that match the XPath).

Hmm, so the reason you prefer select for rename is that given:

  <p:rename>
    <p:option name="select" value="//*/@foo"/>
    <p:option name="name" value="bar"/>
  </p:rename>

and this input:

  <doc>
    <div foo="test">
      <p foo="also"/>
    </div>
  </doc>

You expect

  <doc>
    <div bar="test">
      <p bar="also"/>
    </div>
  </doc>

I think I still prefer my rules, where you'd say:

  <p:rename>
    <p:option name="match" value="@foo"/>
    <p:option name="name" value="bar"/>
  </p:rename>

How does this work for elements?

  <p:rename>
    <p:option name="select" value="//xh:div"/>
    <p:option name="name" value="h:div"/>
  </p:rename>

and this input:

  <xh:div>
    <xh:div foo="test">
      <xh:div foo="also"/>
    </xh:div>
  </xh:div>

You expect

  <h:div>
    <h:div foo="test">
      <h:div foo="also"/>
    </h:div>
  </h:div>

And with match semantics:

  <p:rename>
    <p:option name="match" value="xh:div"/>
    <p:option name="name" value="h:div"/>
  </p:rename>

Only the outer xh:div would be processed.

Yes, I guess select is better for rename. I predict user confusion
about when to use one and when the other.

| Perhaps the option should be named either 'select' or 'match' so that
|> it's clear which kind of expression is intended.
|
| I'd be happy to change the name as appropriate.

Please do, assuming no one objects.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | There is always some accident in the
http://nwalsh.com/            | best of things, whether thoughts or
                              | expressions or deeds. The memorable
                              | thought, the happy expression, the
                              | admirable deed are only partly
                              | yours.--Henry David Thoreau

Received on Tuesday, 24 April 2007 16:32:11 UTC