xsl-list
[Top] [All Lists]

RE: [xsl] Copying image files from one directory to another - using xslt

2009-09-15 10:15:28

I am a newbie with xslt. Trying to create a xsl file that 
transforms one xml to another xml, I have want to do two task 
using xslt.

1). I want to copy some image files (jpeg, gif etc) from one 
directory to another directory.
e.g If I have following element in source xml <image 
src="images/img123.jpg"> </image>

And I want to transform this element into <file type="image" 
src="resources/images/img123.jpg"> </file>

Xslt makes everything easy in above transformation, but i 
don't know how do I copy 'img123.jpg' from 'images' directory 
to 'resources/images' directory.

You could do this in an extension function invoked from XSLT, but my
suggestion would be to run your XSLT transformation within some environment
such as Ant or xmlsh that can do this task more easily.

2). In another transformation I'm reading a html files using
unparsed-text() function, now html data can have any number of 'img' 
tags. I want to use a loop to check all 'img' tags and want 
to change value of src attribute of each img tag - via string 
manipulation.


I wouldn't try to handle HTML as unparsed text using string manipulation. I
would convert it to XML using a parser such as TagSoup, and then manipulate
it as XML.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--