Hello,
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="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="test.xsd">
<Title>test</Title>
<Section Section_comment="testcomment">
<TranslationText variant="variant1">
<TResFilename>testfile.ccc</TResFilename>
</TranslationText>
</Section>
<Section>
<TranslationText>
<TResFilename>testf.ccc</TResFilename>
</TranslationText>
</Section>
</TestOrder>
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?