On 11/7/06, Peter Reilly <[EMAIL PROTECTED]> wrote:
On 11/7/06, Beims Bob-RWBC70 <[EMAIL PROTECTED]> wrote:
> Sorry for the newbie question ... I didn't find a search option @
> http://mail-archives.apache.org/mod_mbox/ant-user/ and 30+ minutes with
> Google couldn't help me find what I'm looking for ...
>
> I'm trying to use the ReplaceRegExp ant task in a build file with the
> DITA Open Toolkit (http://dita-ot.sourceforge.net/). That should tell
> you that I'm *not* a Java developer; I know just enough about Ant to be
> dangerous.
>
> I can't figure out what I'm doing wrong in my installation ... here's
> what I've done to try and get ReplaceRegExp to work:
>
> 1. read the info @
> http://ant.apache.org/manual/OptionalTasks/replaceregexp.html
> 2. downloaded the jakarta-oro-2.0.8.jar and jakarta-regexp-1.4.jar
> packages
There is no need to do this for java >= 1.4.
> 3. placed the class packages in my /ant/lib directory
> 4. included the code below at the end of my dita2xhtml target
>
> <property name="ant.regexp.regexpimpl"
> value="org.apache.tools.ant.util.regexp.JakartaOroRegexp"/>
> <replaceregexp flags="g">
> <regexp pattern="(<img
> src=\")([^\\.]+\\.svg)(\"/?>)"/>
> <substitution expression="<embed src=\"$2\"
> type=\"image/svg+xml\"></embed>"/>
> <fileset
> dir="${output_base}xhtml${file.separator}${ip_type}${file.separator}${ma
> p_name}" includes="**/*.html"/>
> </replaceregexp>
>
> (What I'm attempting to do is wrap SVG files in embed tags rather than
> an img tags ... I've tested the regular expression with a GREP utility
> and it does what I want.)
You may need to "quote the quotes"(tm)
Your regex has >, " etc, if these are in the regex you tested
with grep, they need to be quoted for ant (as ant uses XML).
the \\ may need to be replaced with just a single \.
as the \\ is to escape the \ for the shell with using grep
"(&lt;img src=\&quot;)([^\.]+\.svg)(\&quot;/?&gt;)"/
of course it now looks completely like line noise. (xml/regex/xml encoding)
It may be better to use a task that is designed for xml processing:
like: xmltask - http://www.oopsconsultancy.com/software/xmltask/
or use xslt.
>
> When I execute the target, the XHTML transform executes as expected (it
> produces a working set of .html files), but there is absolutely no
> effect from the replaceregexp task ... nothing in the log file, no
> changes to output files ... zilch.
if the regex does not match anything, nothing happens.
Peter
>
> Any clues?
> Bob
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]