Hi, I am an XML beginner ..looking to create/modify an XSL document dynamically using a Java program..which will be applied to XML to generate HTML In the example stylesheet which has been created manually ,I need to change the bgcolor and border properties of the 2 table tags. I dont know how to reference the appropriate table(Node).I know that XSL document can be created by any XML API ..but i find that too cumbersome. Is there any short cut(programmatically of course) by which i can modify the properties of the table nodes?I googled, but with little luck. Can anyone please guide me the right solution. Thanks a lot
You seem like a total XSLT newbie, so sorry if I go too fast (with instructions or that assumption). But, here are my points:
+ All use of XSLT is done with Java (doing the transformation). You can, however, create XSLT documents and write them however you want, e.g. Vi, Notepad, etc. + You can treat the transformation of an XSLT document the same as any other XML document, with the exception that you need to create an xslt-namespace-alias (I forget exact tag name), so it will not evaluate XSLT tags that you want merely written to the result stream. + Access elements within your transformed document with regular XPath expressions.
That should be a start. Honestly, I understood about 10% of what your problem was, so this may not be of any help to you. I'd recommend using zvon.org's website for a tutorial and reference on XSLT.
Hi Sumit, you might want to look at the given problem. Your example is about changing colors etc. There you better use a customized CSS File, that is plain text. For processing the XML you have 2 options: - Use something like JDOM to access the nodes to change them - If you know in advance what parts of your stylesheet are supposed to change, you can use <xsl: param name="myownname" value="black" /> to define a parameter (use it with $myowname or "{$myownname}" depending where u use it). This parameters (black is only the default value) can be supplied when you execute the XSLT transformation. Hth ;-) stw