Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

xsl

Hi, I start to deal with xml and xsl new.

I try to format an xml page with xsl. xml file like this
----------
<sections>
<section name="A">

<subsection>
...
</subsection>

<subsection>
...
</subsection>

</section>
<section name="B">
</section>
</sections>
-----------
yuo section A have some subsections and section B does not have subsections.
I a xsl:for-each loop to list all section tags
-----------
<xsl:for-each select="/sections/section">
......
</xsl:for-each>
-----------
and I what that is a section have subsection list them again. If not pass
to other section. I think it could be something like that:
-----------
<xsl:if test="?">
<xsl:for-each select="/sections/section/subsections">
......
</xsl:for-each>
</xsl:if>
-----------
What could come agains ?. How can a if statement could do this job.
or beyond this is there any more good architexture.
thanx...
[1123 byte] By [Altay Karaku] at [2007-11-9 15:27:48]
# 1 Re: xsl
Try using the xsl:apply-templates. You can set the match attribute to match
on the sections that change.
"Altay Karaku" <altaykarakus@hotmail.com> wrote:
>
>Hi, I start to deal with xml and xsl new.
>
>I try to format an xml page with xsl. xml file like this
>----------
><sections>
> <section name="A">
>
> <subsection>
> ...
> </subsection>
>
> <subsection>
> ...
> </subsection>
>
> </section>
> <section name="B">
> </section>
></sections>
>-----------
>yuo section A have some subsections and section B does not have subsections.
>I a xsl:for-each loop to list all section tags
>-----------
><xsl:for-each select="/sections/section">
> ......
></xsl:for-each>
>-----------
>and I what that is a section have subsection list them again. If not pass
>to other section. I think it could be something like that:
>-----------
><xsl:if test="?">
> <xsl:for-each select="/sections/section/subsections">
> ......
> </xsl:for-each>
></xsl:if>
>-----------
>What could come agains ?. How can a if statement could do this job.
>or beyond this is there any more good architexture.
>thanx...
Clarence Royal at 2007-11-11 23:29:51 >