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:
- loading xml dom (using
documentbuilder
). - parsing (just doing things
doc.getfirstchild()
). - 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
Post a Comment