xsl-list
[Top] [All Lists]

[xsl] key from one file to another set of files

2008-12-10 06:48:32
Dear All,

input.xml

<articles>
   <row>
         <col>4039</col>
         <col>Review Articles</col>
         <col>1</col>
      </row>
      <row>
         <col>3957</col>
         <col>Review Articles</col>
         <col>9</col>
      </row>
      <row>
         <col>3986</col>
         <col>Papers</col>
         <col>22</col>
      </row>
      <row>
         <col>3985</col>
         <col>Papers</col>
         <col>29</col>
      </row>
</articles>

x number of article.xml files with content:

1.xml

<article>
<aid>4039</aid>
<author>nnn</author>
<title>xxxxx<title>
</article>

2.xml

<article>
<aid>3957</aid>
<author>nnn</author>
<title>xxxxx<title>
</article>

3.xml

<article>
<aid>3986</aid>
<author>nnn</author>
<title>xxxxx<title>
</article>

4.xml

<article>
<aid>3985</aid>
<author>nnn</author>
<title>xxxxx<title>
</article>

Required output:

<cover-body>
<section>
<section-title>Review Articles</section-title>
<para><aid>4039</aid> <author>nnn</author> <title>xxxxx<title>
<page>1</page></para>
<para><aid>3957</aid> <author>nnn</author> <title>xxxxx<title>
<page>9</page></para>
</section>
<section>
<section-title>Papers</sectitle>
<para><aid>3986</aid> <author>nnn</author> <title>xxxxx<title>
<page>1</page></para>
<para><aid>3985</aid> <author>nnn</author> <title>xxxxx<title>
<page>9</page></para>
</section>
<cover-body>

XSL:
<xsl:template match="/" name="main">
<cover-body>
                        <xsl:for-each 
select="collection('file:///D:/cover/sample
xmls/pageall/else/nima?select=*.xml;recurse=yes;on-error=ignore')">
                                <xsl:variable name="a" select="."/>
                                <xsl:if test="key('order', 
'$a/article/item-info/aid')">
                                <xsl:if 
test="(document('input.xml')/articles/row/col[2])[1]">
                                <section>
                                <section-title><xsl:value-of 
select="."/></section-title>
                                <para>
                                        <aid>
                                                <xsl:value-of 
select="$a/article/item-info/aid"/>
                                        </aid>
                                        <aug>
                                                <xsl:apply-templates 
select="$a/article/head/ce:author-group/ce:author"/>
                                        </aug>
                                        <article>
                                                <xsl:value-of 
select="$a/article/head/ce:title"/>
                                        </article>
                                        <page>
                                                <xsl:value-of 
select="document('input.xml')/articles/row/col[3]"/>
                                        </page>
                                </para>
                                </section>
                                </xsl:if>
                                </xsl:if>
                        </xsl:for-each>
                </cover-body>
</xsl:template>

The key is not working for me. i have tried adding the document() in
the match but it is showing the error.

Regards,
Ganesh

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>