This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: my fist question; formating with xsl a xml file
- From: "Ivan Rubin Ayma" <Iayma at mcsla dot com dot ar>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Mon, 11 Mar 2002 14:42:30 -0300
- Subject: RE: [xsl] my fist question; formating with xsl a xml file
- Reply-to: xsl-list at lists dot mulberrytech dot com
<title/> has no <title/> parents,
that's why the for-each ancestor::title will not work
you should (with your structure) use for-each ancestor::answer, or
ancestor::question.
> -----Mensaje original-----
> De: Carlos [mailto:linux@lpis.com]
> Enviado el: lunes, 11 de marzo de 2002 14:33
> Para: xsl-list@lists.mulberrytech.com
> Asunto: Re: [xsl] my fist question; formating with xsl a xml file
>
>
> i want to make a forum and i must to format the output to that.
>
> title 1 1 1
> ===title 1 1 2
> ===title 1 1 3
> =======title 1 1 4
> =======title 1 1 5
> ===title 1 1 6
> ============title 1 1 7
> ============title 1 1 8
>
> with your xsl appears:
>
> == 1
> == 11
> == 12
> == 121
> == 122
> == 1221
> == 1222
> == 12221
> == 122211
>
>
> and not
>
> == 1
> === 11
> === 12
> ==== 121
> ====122
> ==== 1221
> ==== 1222
> ===== 12221
> ====== 122211
>
>
> ----- Original Message -----
> From: "Ivan Rubin Ayma" <Iayma@mcsla.com.ar>
> To: <xsl-list@lists.mulberrytech.com>
> Sent: Monday, March 11, 2002 5:12 PM
> Subject: RE: [xsl] my fist question.
>
>
> > <xsl:template match="/">
> > <!-- apply all the templates named 'titulo' all over the
> > document
> > (sometimes inside a question, sometimes inside a
> > 'respuesta')-->
> > <xsl:apply-templates select="//titulo">
> > <xsl:sort/>
> > </xsl:apply-templates>
> > </xsl:tempalte>
> >
> > <xsl:template match="titulo">
> > <!-- For each ancestor named 'titulo' -->
> > <for-each select="ancestor::titulo">
> > ===
> > </for-each>
> > <xsl:value-of select="."/>
> > </xsl:template>
> >
> > title 1 1 1
> > ===title 1 1 2
> > ===title 1 1 3
> > =======title 1 1 4
> > =======title 1 1 5
> > ===title 1 1 6
> > ============title 1 1 7
> > ============title 1 1 8
> >
> > But I don't fully understand your xml structure, and I
> don't think this
> > is what you're looking for.
> >
> > Hope it helps anyway,
> >
> >
> > > -----Mensaje original-----
> > > De: Carlos [mailto:linux@lpis.com]
> > > Enviado el: lunes, 11 de marzo de 2002 12:44
> > > Para: XSL-List@lists.mulberrytech.com
> > > Asunto: [xsl] my fist question.
> > >
> > >
> > > Hello this is my first question to this list.
> > >
> > > i i have this xml file:
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > >
> > > <FOROS>
> > > <FORO>
> > > <TITLE>TITLE 1</TITLE>
> > > <QUESTIONS>
> > > <QUESTION>
> > > <TITLE>TITLE 1 1</TITLE>
> > > <TEXT>TEXT 1 1</TEXT>
> > > </QUESTION>
> > > <QUESTION>
> > > <TITLE>TITLE 1 2</TITLE>
> > > <TEXT> TEXT 1 2QUESTION</TEXT>
> > > <RESPUESTA>
> > > <TITLE>TITLE 1 2 1</TITLE>
> > > <TEXT>TEXT 1 2 1</TEXT>
> > > </RESPUESTA>
> > > <RESPUESTA>
> > > <TITLE>TITLE 1 2 2</TITLE>
> > > <TEXT>TEXT 1 2 2</TEXT>
> > > </RESPUESTA>
> > > <RESPUESTA>
> > > <TITLE>TITLE 1 2 3</TITLE>
> > > <TEXT> TEXT 1 2 3</TEXT>
> > > <RESPUESTA>
> > > <TITLE>TITLE 1 2 3 1</TITLE>
> > > <TEXT> TEXT 1 2 3 1</TEXT>
> > > </RESPUESTA>
> > > <RESPUESTA>
> > > <TITLE>TITLE 1 2 3 2</TITLE>
> > > <TEXT> TEXT 1 2 3 2</TEXT>
> > > </RESPUESTA>
> > > <RESPUESTA>
> > > <TITLE>TITLE 1 2 3 3</TITLE>
> > > <TEXT>TEXT 1 2 3 2</TEXT>
> > > </RESPUESTA>
> > > </RESPUESTA>
> > > </QUESTION>
> > > </QUESTIONS>
> > > </FORO>
> > > </FOROS>
> > >
> > >
> > > how can i, with xsl file, format the output in this form:
> > >
> > >
> > >
> > > TITLE 1
> > > TITLE 1 1
> > > TITLE 1 2
> > > TITLE 1 2 1
> > > TITLE 1 2 2
> > > TITLE 1 2 3
> > > TITLE 1 2 3 1
> > > TITLE 1 2 3 2
> > >
> > >
> > > Using the xsl fiel, how can i format in that form? hoiw is
> > > the xsl syntax
> > > for sorting that?
> > > the xml file can be a big xml and it can have TITLE 1 X X X trees
> > >
> > > Thanks
> > > Carlos
> > >
> > >
> > > 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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list