Hema Rajan a écrit :
> 
> Hi there!
> 
> We have to match an element which is in 4 or 5 th level from the current
> level.  Is there anyway to find out this element without giving the
> absolute/relative path in the xsl?
> 
> For example, our XML file is as follows:
> 
> <cms:form>
>         <cms:table>
>                 <cms:row>
>                         <cms:cell>
>                                 <cms:input name="abc" value="1"/>
>                         </cms:cell>
>                 </cms:row>
> 
>                 <cms:row>
>                         <cms:cell>
>                                 <cms:input name="xyz" value="2"/>
>                         </cms:cell>
>                 </cms:row>
>         </cms:table>
> </cms:form>
> 
> In our stylesheet we have the following template:
> 
> <xsl:template match="cms:form">
>                 <xsl:apply-templates select='input'/>
>                 <xsl:if test="@submit">
>                         <!--if the form has "submit" param, a submit button
> is added with label equal to the value of "submit"-->
>                         <do type="accept" label="{@submit}">
>                                 <go href="{@modpage}" method="post">
>                                         <xsl:for-each select="input">
>                                                 <postfield name="{@item}"
> value="$({@item})"/>
>                                         </xsl:for-each>
>                                 </go>
>                         </do>
>                 </xsl:if>
> </xsl:template>
> 
> The above template works fine only if the <input> element is directly below
> the <cms:form> tag.  It will not work if the <input> element is 2 or 3
> levels below the <cms:form> tag.  We tried replacing the
> "<xsl:apply-templates select='input'/>" line with
> "<xsl:apply-templates select="//input"/>".  Even this did not work.  Any
> suggestions?
> 
> regards,
> Hema.
> 

Just look at your XML file : it's not "input" but "cms:input" !
-- 
Sylvain Wallez
Anyware Technologies - http://www.anyware-tech.com

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to