java - Transform an "empty" XML with XSLT or: How to use an XML Template? -


is possible transform "empty" or non-existing xml xml xslt?

what i'm trying fill in couple of parameters template xml.

say, xml looks like:

<sometag value="somevalue">somevalueorother</sometag> <othertag>dynamicvalue</othertag> 

how fill these values?

i generate empty xml document , transform (and disregard input), seems ugly. i'd rather use sort of template.

also, i'm no fan of doing things in code jaxb:

mydoc.getsomeelement().getsomethingnested().getevenmorenested().setfooelement("someval"); 

ideally, have static xml-file placeholders or that.

one (little-known) approach use "simplified stylesheet" syntax.

use stylesheet this:

<root xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform">     <fixedtag>fixed content</fixedtag>     <sometag><xsl:value-of select="*/param1"/></sometag>     <othertag><xsl:value-of select="*/param2"/></othertag> </root> 

and source document this:

<params>   <param1>variable content 1</param1>   <param2>variable content 2</param2> </params> 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -