xsl-list
[Top] [All Lists]

Re: [xsl] Error: sequence of more than one item not allowed

2011-10-04 05:21:07
Hi Andrew and Michael,
Michael,
Sorry, I normally do provide sample input and a context, but it would have taken a great deal of time to set up and it is just after 3 am. Luckily, Andrew spotted exactly what I needed.

Andrew,
Perfect! (And I would have never thought of using the grouping key, but now I know.)

You are right (2)'s grouping key does look odd. It is used to output a set of XHTML navigation buttons keyed to the "other kinds of formats available in <Formats>". In full, (2) looks quite strange, but it has replaced almost five pages of complex string parsing and testing. Ken Holman got on my case about my using so much C++ idiom string-parsing, so I been trying to work with just the nodes. My unexplained cps:functions mostly output formatted text for the XHMTL page.

Thanks to you both,
Mark

(2) in full:

<!-- Show related formats -->
     <xsl:choose>
<xsl:when test="count(../../Stamp/Formats/@*[not(name(.)=$format)]) eq 1"> <xsl:if test="../../Stamp/Formats/@*[not(name(.)=$format)] eq $item">
           <a lang="en" class="button"
href="{concat(ancestor::Set/@year, '-',../../Stamp/Formats/@*[not(name(.)=$format)],cps:file-format-from-name(name(../../Stamp/Formats/@*[not(name(.)=$format)])), '.htm')}"> <xsl:value-of select="cps:english-format-name(name(../../Stamp/Formats/@*[not(name(.)=$format)]))"/>
           </a>
           <a lang="cz" class="button"
href="{concat(ancestor::Set/@year, '-', ../../Stamp/Formats/@*[not(name(.)=$format)], cps:file-format-from-name(name(../../Stamp/Formats/@*[not(name(.)=$format)])),'.htm')}"> <xsl:value-of select="cps:czech-format-name(name(../../Stamp/Formats/@*[not(name(.)=$format)]))"/>
           </a>
         </xsl:if>
       </xsl:when>
       <xsl:otherwise>
<xsl:for-each-group select="../../Stamp/Formats" group-by="@*[not(name(.)=$format)]">
           <xsl:for-each select="current-group()">
             <xsl:if test="current-grouping-key() eq $item">
<a lang="en" class="button" href="{concat(ancestor::Set/@year, '-', @*[not(name(.)=$format)],cps:file-format-from-name(name(@*[not(name(.)=$format)])), '.htm')}"> <xsl:value-of select="concat(cps:english-format-name(name(@*[not(name(.)=$format)])), ' ')"/>
                 <xsl:value-of select="position()"/>
               </a>
<a lang="cz" class="button" href="{concat(ancestor::Set/@year, '-', @*[not(name(.)=$format)], cps:file-format-from-name(name(@*[not(name(.)=$format)])),'.htm')}">
                 <xsl:value-of select="position()"/>
<xsl:value-of select="concat('. ', cps:czech-format-name(name(@*[not(name(.)=$format)])))"/>
               </a>
             </xsl:if>
           </xsl:for-each>
         </xsl:for-each-group>
       </xsl:otherwise>
     </xsl:choose>






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