Q:

XQUERY return result in format 

I am using an XQUERY FLWOR expression into an .xml file:
for $dynosaur in doc("document.xml")//species
 let $dynosaurName := $dynosaur/text()        // keeping the dynosaurName as a variable
return $dynosaur 

The above return results like:
<species age="84">Velociraptor</species>

I need to format the result to be like:
<! ELEMENT dynosaur (Velociraptor) +>

so i am trying using the below but not working...
return <! ELEMENT dynosaur ({$dynosaurName}) +> //here i want that format but it return error

And the xml file:
<? xml version="1.0"? >
<dinosauria>
    <group>
        <name>saurishia</name>
        <subgroups>
            <group>
                <name>theropoda</name>
                <subgroups>
                    <group>
                        <name>carnosaurs</name>
                        <speciesList>
                            <species age="74">Dyptosaurus</species>
                            <species age="170">Megalosaurus</species>
                            <species age="67">Tyrannosaurus</species>
                        </speciesList>
                    </group>
                    <group>
                        <name>coelurosauria</name>
                        <speciesList>
                            <species age="84">Velociraptor</species>
                            <species age="110">Deinonychus</species>
                            <species age="228">Eoraptor</species>
                        </speciesList>
                    </group>
                </subgroups>
            </group>
            <group>
                <name>sauropodomorpha</name>
                <subgroups>
                    <group>
                        <name>sauropods</name>
                        <speciesList>
                            <species age="155">Brachiosaurus</species>
                            <species age="155">Camarasaurus</species>
                        </speciesList>
                    </group>
                </subgroups>
            </group>
        </subgroups>
    </group>
    <group>
        <name>ornithishia</name>
        <subgroups></subgroups>
    </group>
</dinosauria>

Finally:
I can't find any way to return that type of result .  I have checked a lot of links considering and this book : http://www.datypic.com/books/xquery/chapter09.html

A:

Could you try outputting text? 
return concat("<!ELEMENT dynosaur (",$dynosaurName, ") +>")

