xml - How to transform multiple documents contained in a single file using xsltproc? -


i have file several xml documents in single line. like:

<entity id ="1"><attribute name="x">1</attribute><attribute name="y">2</attribute></entity> <entity id name="2"><attribute name="x">5</attribute><attribute name="y">6</attribute></entity> <entity id name="3"><attribute name="x">8</attribute><attribute name="y">9</attribute></entity> 

i apply transformation using xlstproc gives me parsing error since not formed xml (no single root element) because each line complete xml document.

is there way can without putting each document in single file?

i thought of including dummy root element avoid this.

try linux/unix/posix shell script:

#!/bin/sh  # assuming x.xsl transform, # , x.xml contains 1 well-formed doc per line, # following loop perform transform # on each line individually  while read i;     echo $i | xsltproc x.xsl - done < x.xml 

Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -