Subject: RE: [xsl] how to extrac some child nodes and show. please help me. thanks From: "Michael Kay" <mhk@xxxxxxxxx> Date: Mon, 8 Sep 2003 10:56:49 +0100 |
> > thanks for your answer. > now i want to show into one table but i have writte code doesn't run. Well it does run actually, but presumably you mean that it doesn't do what you wanted. > the code is this: > <?xml version="1.0" encoding="ISO-8859-1"?> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > <xsl:output method="html" version="1.0" encoding="ISO-8859-1" > indent="yes"/> > <xsl:strip-space elements="*"/> > <xsl:template match="registros"> > <table border="1"> > <tr> > <td><xsl:call-template name="padrehijo"/></td> > </tr> > </table></xsl:template> > <xsl:template match="padre | hijo" name="padrehijo"> > <xsl:for-each select="ancestor::*[self::hijo or > self::padre]"></xsl:for-each> What is this empty for-each trying to do? It's clearly nonsense to say "for each ancestor do nothing". > <xsl:value-of select="id_cliente"/> > <xsl:text> </xsl:text> > <xsl:value-of select="nombre_cliente"/> > <xsl:text> </xsl:text> > <xsl:value-of select="apellido_cliente"/> > <xsl:apply-templates select="hijo"/> > </xsl:template> You're calling this named template with "registros" as the context node, and the only child of a "registros" element is a "padre" element. So the rest of this code does nothing. Michael Kay > </xsl:stylesheet> > > > > > Can you help me please? > thanks for your help. > > > > > > > > > > ----- Original Message ----- > From: <Jarno.Elovirta@xxxxxxxxx> > To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> > Sent: Monday, September 08, 2003 7:13 AM > Subject: RE: [xsl] how to extrac some child nodes and show. > please help me. > thanks > > > > Hi, > > > i want to show the xml file in this method: > > > id 1.1 nombre 1.1 apellido 1.1 > > > id 2.1 nombre 2,1 apellido 2.1 > > > - id 2.1.1 nombre 2.1.1 apellido 2.1.1 > > > -- id 2.1.1.1 nombre 2.1.1.1 apellido 2.1.1.1 > > > id 2.2 nombre 2.2 apellido 2.2 > > > > The last one should probably have a leading hyphen, right? Anyhow, > > > > <xsl:template match="padre | hijo"> > > <xsl:for-each select="ancestor::*[self::hijo or > self::padre]">-</xsl:for-each> > > <xsl:value-of select="id_cliente"/> > > <xsl:text> </xsl:text> > > <xsl:value-of select="nombre_cliente"/> > > <xsl:text> </xsl:text> > > <xsl:value-of select="apellido_cliente"/> > > <xsl:text>
</xsl:text> > > <xsl:apply-templates select="hijo"/> > > </xsl:template> > > > > Cheers, > > > > Jarno - The Dust of Basement: Inside > > > > XSL-List info and archive: > http://www.mulberrytech.com/xsl/xsl-list > > > > > > > > > > XSL-List > info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] how to extrac some child , Dionisio Ruiz de Zar | Thread | [xsl] how to evaluate a dyna genera, Cao Hui |
Re: [xsl] how to evaluate a dyna ge, Andrey Solonchuk | Date | [xsl] A difference in node builds, Vorndran, Charles P |
Month |