velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wido Hillmann <wido.hillm...@epost.de>
Subject Re: DVSL - replace tags inside unknown parent tags
Date Fri, 06 Dec 2002 10:17:45 GMT
Tank You Bill,

I forgot to say that i like leave the rest of the unknown tree as it is
and copy it to the output.

from:

<variable-tag>
        <foo/><bar/>
        <tag-to-replace>other elements</tag-to-replace>
        <etc/>
</variable-tag>

to:

<variable-tag>
        <foo/><bar/>
        <replaced-tag>other elements</replaced-tag>
        <etc/>
</variable-tag>


I found a solution in xslt:

<template match="*|@*|text()|processing-instruction()">
  <copy>
    <apply-templates select="*|@*|text()|processing-instruction()"/>
  </copy>
</template>

<template match="tag-to-replace">
  <replaced-tag>
    <apply-templates select="*|@*|text()|processing-instruction()"/>
  </replaced-tag>
</template>

The first xslt- template works rekursiv. It copies only one node and
than looks again above all templates. I've tried to copy this
implementation to dvsl. But how can i copy only one unknown node? I
found in the DVSL spec. only directives to copy a hole tree ("deep
copy"). So the following try doesnt work:

#match("*")
$node.copy($node.selectNodes( "." ))##copys again the hole tree
$context.applyTemplates("*")
#end

-Wido

--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message