xsl-list
[Top] [All Lists]

Re: [xsl] No Duplicate Contain() is Allowed?

2007-12-16 22:36:53
1. Your XML is not well-formed, look at:
 <publisher>Oreilly</publisher

2. Commenting out the last xsl:if does not make any difference when I
test with SAXON 9B.

3. The contains() function is for testing a string. But your xml
element contains mixed content that is both other elements and text
nodes.

It is not a good idea to mark up data as mixed content.

This is much better:
<book>
        <name>XSLT 2.0: From Beginning to Professional</book>
        <topic>XML</topic>
        <publisher>Wiley</publisher>
</book>

Cheers,
Jesper Tverskov


On 12/17/07, Alice Wei <ajwei(_at_)indiana(_dot_)edu> wrote:
Dear all:

   For those of you who may know something about SQL or XQuery might
be able to help me out.

XML:
     <bookshelf>
     <book>XSLT 2.0: From Beginning to Professional
       <topic>XML</topic>
      <publisher>Wiley</publisher></book>
     <book>XML in a Nutshell
     <publisher>Oreilly</publisher</book>
     <book>XSLT 2.0: Programmer's Reference
     <topic>XML</topic>
     <publisher>Wrox</publisher>
     </book>
     </bookshelf>

XSLT:

<xsl:template match="bookshelf">

       <xsl:if test="contains(//book/*, 'XML')">
           <xsl:apply-templates/>
       </xsl:if>
      <xsl:if test="contains(//topic/*, 'XML')">
         <xsl:apply-templates/>
     </xsl:if>
</xsl:template>


What happened is really weird. If I had commented out the 2nd <xsl:if>
statement, it brings back one line without error. When I got to the 2nd
one, it tells me this error: Description: A sequence of more than one
item is not allowed as the first argument of contains() ("", "", ...)

My document is obviously well-formed, can anyone please give me some
suggestions on how to get rid of this error?

Thanks to those who can help.

Alice


Alice Wei
MIS 2008
School of Library and Information Science
Indiana University Bloomington


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




-- 
Jesper Tverskov

www.xmlkurser.dk
www.xmlplease.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>
--~--

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