xsl-list
[Top] [All Lists]

RE: [xsl] multiple files to single file problem

2008-12-09 08:36:46

      <xsl:template match="/" name="main">
              <xsl:element name="cover-body">

It's so much clearer if you use literal result elements: <cover-body>
instead of <xsl:element name="cover-body">.

                      <xsl:for-each select="for $x in 
collection('file:///D:/cover/sample
xmls/pageall/else/nima?select=*.xml;recurse=yes;on-error=ignore')
return $x">

The XPath expression "for $x in EXPR return $x" can always be rewritten
"EXPR". You just want

<xsl:for-each select="collection(....)">

                              <xsl:variable name="a" 
select="document(document-uri(/))"/>

That's equivalent to <xsl:variable name="a" select="."/>

              <xsl:element name="author">
                                                      
<xsl:value-of 
select="$a/article/head/author-group/author/given-name"/>
                                                      <xsl:text/>
                                                      
<xsl:value-of select="$a/article/head/author-group/author/surname"/>
                                              </xsl:element>
                                      </xsl:element>

xsl:value-of takes the selected nodes (all the given-names) and outputs
their values, space-separated. So you have asked for all the given-names,
space-separated, then all the surnames, space-separated. What you want is
this:

<author>
  <xsl:for-each select="$a/article/head/author-group/author">
    <xsl:value-of select="given-name, surname"/>
  </xsl:for-each>
</author>

perhaps with some added punctuation or markup.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
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>
--~--