Hi, I want to use xslt to convert xhtml to xhtml, just changing the attributes of some elements(img and a). It's all going well, except the output I'm getting is all the elements in the order they apear in the origonal. Here is my code:
How can I make it so's the node tree stays the same, with just my changes to the attributes of those elements? Regards, Brendan
Its too difficult to look for a solution if one sees only part of the problem. So you might post your xml input file. For me the xslt debugger of WSAD is a great help to understand xslt/xPath. XMLSpy seems to have similar feature in their version 5, which is even better because it shows output. It surely is an efective help for problems like yours.
from xml-spy site: Step through an XSLT transformation process line-by-line with a 3-panel interface that displays the input XML document (with context node highlighted), the XSLT stylesheet (with current node highlighted), and the output document as it is being built in real-time.
I think you can use the identity template, and then add specific templates for your specific elements/attributes. identity template Good luck!
Joined: May 02, 2001
Thanks for the replies the xsl wasn't working totally fine. it was working ok in that the img tag was getting changed in the way I wanted. The elements were being sorted into the order they apeared in in the origonal file, ie with no children. I'm using xml spy 4.3 and (I think) the msxml parser. The files I'm using are at : http://www.redbrick.dcu.ie/~keno/ranch/ The other xsl there is trying it using templates. I haven't gotten working with the identity template yet, hopefully that does it Thanks again Brendan
Joined: Nov 14, 2000
The identity template will guarantee you have everything else work correct. You need only to focus on the elements you need to change. Your original code on attribute has a problem, which is that if img tag has width/height/etc. other attributes, they will be lost. I might try to make it work when I've some time, but it is not a promise.