Transforming XML with Java -


i learning how convert xml file html using java, later decided learn how use xslt language same.


by saying just java, mean, using syntax of java language, is, not xslt language.


to clarify:

  1. loading xml dom (using documentbuilder).
  2. parsing (just doing things doc.getfirstchild()).
  3. writing html file (just using character stream, not xml serialization).

what happened?

after include following line in xml:

<?xml-stylesheet type="text/xsl" href="mystylesheet.xsl"?>

my java application couldn't write html right...

if remove that, right, want keep it.

any ideas how ignore "instruction"?

xslt ignore processing instructions (that is, remove them) default. if want retain one, add template rule so:

<xsl:template match="processing-instruction('xml-stylesheet')">   <xsl:copy/> </xsl:template> 

this assumes stylesheet written in classic recursive-descent style using apply-templates; if you're self-taught in xslt might not have yet learnt style. always, it's easier people when show code.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -