如今,我是新鲜的,在Xquery世界。 我无法想起起点,在Marklogic Xquery写道以下逻辑。 我很感谢大家给我的想法/意愿,以便我实现以下目标:
我想根据在B.XML中的一字眼调查,对A.XML进行 Qu。 彩礼应当生产C.XML。 逻辑应当如下:
A.XML
<root>
<content> The state passed its first ban on using a handheld cellphone while driving in 2004 Nokia Vodafone Nokia Growth Recession Creicket HBO</content>
</root>
B.XML
<WordLookUp>
<companies>
<company name="Vodafone">Vodafone</company>
<company name="Nokia">Nokia</company>
</companies>
<topics>
<topic group="Sports">Cricket</topic>
<topic group="Entertainment">HBO</topic>
<topic group="Finance">GDP</topic>
</topics>
<moods>
<mood number="4">Growth</mood>
<mood number="-5">Depression</mood>
<mood number="-3">Recession</mood>
</moods>
C.XML (Result XML)
<root>
<content> The state passed its first ban on using a handheld cellphone while driving in 2004 Nokia Vodafone Nokia Growth Recession Creicket HBO</content>
<updatedElement>
<companies>
<company count="1">Vodafone</company>
<company count="2">Nokia</company>
</companies>
<mood>1</mood>
<topics>
<topic count="1">Sports</topic>
<topic count="1">Entertainment</topic>
</topics>
<word-count>22</word-count>
</updatedElement>
</root>
Search each company/text() of A.xml in B.xml, if match found create tag: TAG {company count="Number of occurrence of that word"}company/@name {/company}
Search each topic/text() of A.xml in B.xml, if match found create tag TAG {topic topic="Number of occurrences of that word"}topic/@group{/topic}
Search each mood/text() of A.xml in B.xml, if match found [occurrences of first word * {/mood[first word]/@number}] + [occurrences of second word * {/mood[second word]/@number})]....
内容字数。