Problem with Result from XQuery


I have a problem with getting the right result from an XQuery.

At first my test xml file:

<?xml version="1.0" encoding="UTF-8"?>
<?altova_sps test.sps?>
<?xml-stylesheet type="text/xsl" href="Textorder.xsl"?>
<TestOrder xmlns:xsi="" xsi:noNamespaceSchemaLocation="test.xsd">
    <Section Section_comment="testcomment">
        <TranslationText variant="variant1">

Here is the query1 that returns the result I want.
The result is TranslationText with the “variant1”.

Query 1:

for $a in input()/TestOrder/Section/TranslationText
where $a/@variant='variant1'
return <result>{$a}</result>

But with the query2, I get both sections back. I think that these two queries have the same meaning, or is that not right?

Query 2:

for $a in input()/TestOrder
where $a/Section/TranslationText/@variant='variant1'
return <result>{$a/Section/TranslationText}</result>

I need Query2 with the result of Query 1, because I have to expand this query, which is only in the format of Query2 possible.

Can anybody help me?

These 2 Queries are not the same.
For the first, you retrieve translation text where the variant is variant1.

For the second, you retrieve all translation text from TestOrders which have at least one translation text where the variant is variant1

Thanks for your fast answer.

But do I have to change the second query to get the result from the first query.

My problem is that I need the root element as reference. But this is with the first query not possible.

Any ideas?

does this help:

for $a in input()/TestOrder
let $t := $a/Section/TranslationText
where $t/@variant='variant1'
return <result>{$t}</result>