Pregunta

I'd like to recursively find every "foo.xml" file and on each foo.xml apply the xslt bar.xsl and save over the original foo.xml. When I run the following commands, separately, they work.

find . -name foo.xml
xsltproc -o foo.xml bar.xsl foo.xml

But, when I pipe them, nothing happens to foo.xml.

find . -name foo.xml | xargs xsltproc -o foo.xml bar.xsl
¿Fue útil?

Solución

Warning both of these will obviously overwrite the xml's with the transformation as asked in the question.

With you want to do something like

find . -name foo.xml -print0 | xargs -I {} -0 xsltproc -o {} transform.xsl {}

Or with -exec

find . -name foo.xml -exec  xsltproc -o {} transform.xsl {} \;
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top