|
Subject: RE: [xsl] Help with some XPATH questions From: Vincenzo Menanno <enzo13@xxxxxxx> Date: Thu, 28 Jul 2005 17:22:41 -0700 |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Help with some XPATH ques, Michael Kay | Thread | RE: [xsl] Help with some XPATH ques, Michael Kay |
| RE: [xsl] is there a String indexOf, Michael Kay | Date | RE: [xsl] Help with some XPATH ques, Michael Kay |
| Month |