cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JEULIN Olivier <olivier.jeu...@xml-ais.com>
Subject RE: Doubt in aplying stylesheet using Cocoon's xslt processor.
Date Thu, 19 Jul 2001 09:50:20 GMT
Use <xsl:apply-templates select="//cms:input"/>

You may find http://www.dpawson.co.uk/xsl/sect2/sect21.html usefull for this
king of questions
Olivier

> -----Message d'origine-----
> De : Hema Rajan [mailto:hrajan@indts.com]
> Envoyé : jeudi 19 juillet 2001 11:52
> À : cocoon-users@xml.apache.org
> Objet : Doubt in aplying stylesheet using Cocoon's xslt processor.
> 
> 
> 
> 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?  

---------------------------------------------------------------------
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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message