[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Help with some XPATH questions

Subject: RE: Help with some XPATH questions
From: Vincenzo Menanno <enzo13@xxxxxxx>
Date: Thu, 28 Jul 2005 17:22:41 -0700
vincenzo menanno
Michael,

Well your suggestions helped me get rid of the error messages but all I get is a count of 13 items and none of the rest of the xml is filled out ... not sure why.

Your explanation helped but now I am not sure why I am not getting any of the other parts into the xml document.

Do you have any other suggestions as to what i could do... Thanks

Vince
 
On Thursday, July 28, 2005, at 02:19PM, Michael Kay <mike@xxxxxxxxxxxx> wrote:

>> 
>> So far what I have is 
>> 
>>             <RESULTSET>
>>                 <xsl:attribute name="FOUND">
>>                     <xsl:value-of 
>> select="count(//LayoutCatalog/Layout)"/>
>>                 </xsl:attribute>
>>                 <xsl:apply-templates 
>> select="//LayoutCatalog/Layout/descendant::Object[@type='text']"/>
>>             </RESULTSET>
>> 
>> 
>> I thought that this would work but it does not... this is the 
>> error I get:
>> 
>> Description: E Error in expression 
>> //LayoutCatalog/Layout/descendant::Object[@type='text']: Axis 
>> in pattern must be child or attribute
>
>It's a bad error message because it says first that it's an error in an
>expression and then that it's an error in a pattern, and expressions and
>patterns are quite different things. But it's patterns that don't allow axes
>other than child or attribute, so that's almost certainly what it's
>referring to. The select attribute of apply-templates is not a pattern, it's
>an expression. Your error is probably that you have used a similar construct
>in an <xsl:template match="XXX"> context, where it is not allowed.
>
>In a match pattern you can't write A/descendant::B, but you can write A//B
>which usually means the same thing. (The cases where it doesn't are where B
>is followed by a numeric predicate).
>> 
>> I guess what I don't understand this error - and I also don't 
>> really understand the role of
>> 
>> "<xsl:attribute name="FOUND">"
>
>Your code snippet creates a RESULTSET element, with a FOUND attribute whose
>value is the number of //LayoutCatalog/Layout elements in the source
>document, with the content of the element being computed by the template
>that matches the selected Object elements.
>
>You could also have written this as:
>
><RESULTSET FOUND="{count(//LayoutCatalog/Layout)}">
>  <xsl:apply-templates
>select="//LayoutCatalog/Layout//Object[@type='text']"/>
></RESULTSET>
>
>Michael Kay

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.