commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Dodinet <rhi...@free.fr>
Subject Re: [jelly-xml] (solved) xml:copy outputs attributes as text also
Date Sun, 11 Jan 2004 22:46:17 GMT
Paul,

thank you very much for your help. i think it really helped by giving me 
ideas on how to fix the problem i was encountering. i was using jexl and 
xpath. i explain here how i solved the problem in case someone is 
interested.
i had smtg like [1] in jsl file. i used <jsl:applyTemplates select="* | 
text()"/> to ensure that attribute values were not output as text (my 
first post in this thread), and the first template was defined to make 
sure that text nodes were rendered (otherwise they didnt appear). 
however that didnt do it since text children were outputted after all 
other children. i solved that by just defining another empty template : 
<jsl:template match="@"/> and replacing the <jsl:applyTemplates 
select="* | text()"/> isntruction by this one <jsl:applyTemplates />.

this "solution" seems to work, however im not really satisfied with it, 
because it seems a bit weak. but, well, that will do it for now. thanks 
again.

[1]
--------- previous bogus templates -------------
   <jsl:template match="text()">
         <x:set var="p" select="."/>
         ${p.get(0).getText()}
   </jsl:template>
           
    <jsl:template match="*">
       <x:copy>
           <jsl:applyTemplates select="* | text()"/>
       </x:copy>
    </jsl:template>
------------------------------------------------

-- gd

Paul Libbrecht wrote:

> Gilles,
>
> Is there any reason you don't use something like the following ??
>
> <x:forEach select="$doc/img/@href" var="hrefAtt">
>     ${hrefAtt.setValue('myNewValue')}
>     </x:forEach>
>
> I've been pretty much more successful using a mix of jexl-method-calls 
> and xpath than plain-xpath with the XML-taglib. The only issue is the 
> type of the result of an XPath expression which can be very diverse...
>
> (oh, and you might be bitten by the HTML output btw... the solution is 
> dom4j-1.4 or to fix 1.4-b8).
>
> Paul




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message