1

I have a xml document whithout a root, and I need create this root using xsl for this, anybody can help me please!

Like example I have this document:

<entity>
    <name>Jhon</name>
    <age>20</age>
</entity>
<entity>
    <name>Mary</name>
    <age>22</age>
</entity>

A xml document with two entities but without root!

1
  • Hmmm..., not sure, but I doubt there is any XSL transform utility that will accept your input -- it's not a valid XML document. Commented Aug 29, 2013 at 18:32

1 Answer 1

4

You don't have an XML document, you have an XML external parsed general entity.

And you don't need XSLT to make an XML document out of it.

If the file you have is named "file.ent", then all you need is (modulo any typos I make below) an XML document "file.xml" along the lines of:

<!DOCTYPE doc
[
<!ENTITY file SYSTEM "file.ent">
]>
<doc>&file;</doc>

Now when you process "file.xml", the XML processor will pull in your "file.ent" underneath the given document element (defined as the top-most element of an XML document). It doesn't have to be named "doc".

If you want to make a single XML file from the above two files, then use XSLT and the identity transform.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.