Subject: RE: [xsl] finding nodes From: Americo Albuquerque <aalbuquerque@xxxxxxxxxxxxxxxx> Date: Sat, 15 Mar 2003 18:47:39 -0000 |
Hi. > -----Mensagem original----- > De: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] Em nome de jm > Enviada: sabado, 15 de Marco de 2003 15:14 > Para: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Assunto: [xsl] finding nodes > (...) > in my xsl-document I have the following parameter: > (later given via GET-request-params/Cocoon) > > <xsl:param name="goto_page" > select="SECTION_1/SUB_SECTION_1_1/SUB_SUB_SECTION_1_1_1"/> > > an now I want to enter the node specified by the path given > in $goto_page. this path > has no restriction in depth. > If goto_page is a nodeset then you just need to do <xsl:apply-templates select="$goto_page"/> If it is a string then you need an xxx:evaluate function (xxx depends on your processor) You could also use this templates, but they split the path: <xsl:param name="goto_page" select="'SECTION_1/SUB_SECTION_1_1/SUB_SUB_SECTION_1_1_1'"/> <xsl:template match="pages"> <xsl:param name="page" select="substring-before($goto_page,'/')"/> <xsl:apply-templates select="page[@id=$page]"> <xsl:with-param name="passed" select="$page"/> </xsl:apply-templates> </xsl:template> <xsl:template match="page"> <xsl:param name="passed" select="''"/> <xsl:param name="next" select="substring-before(concat(substring($goto_page,string-length($pass ed)+2),'/'),'/')"/> <xsl:choose> <xsl:when test="not($next)"> <!-- page found --> <xsl:comment> Just arrived to page </xsl:comment> <xsl:copy-of select="."/> </xsl:when> <xsl:otherwise> <!-- continue the searching --> <xsl:apply-templates select="page[@id=$next]"> <xsl:with-param name="passed" select="concat($passed,'/',$next)"/> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xsl:template> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
<- Previous | Index | Next -> |
---|---|---|
[xsl] finding nodes, jm | Thread | Re: [xsl] finding nodes, jm |
RE: [xsl] Hmmmm.... translate funct, Americo Albuquerque | Date | [xsl] Large Document, Jack Cane |
Month |