|
Subject: [xsl] trying to create surrounding element From: Andreas Peter <info@xxxxxxxxxx> Date: Sun, 08 Jun 2008 18:59:55 +0200 |
<?xml version="1.0" encoding="UTF-8"?>
<aaa>
<bbb>
<ccc>
<ddd attribute="boxtype_start"/>
</ccc>
<eee>box1_start</eee>
</bbb>
<bbb>
<ccc>
<ddd attribute="boxh1"/>
</ccc>
<eee>1_boxtitle_h1</eee>
</bbb>
<bbb>
<ccc>
<ddd attribute="boxh2"/>
</ccc>
<eee>1_boxtitle_h2</eee>
</bbb>
<bbb>
<ccc>
<ddd attribute="boxpara"/>
</ccc>
<eee>boxpara</eee>
</bbb>
<bbb>
<ccc>
<ddd attribute="boxtype_end"/>
</ccc>
<eee>box1_end</eee>
</bbb>
<bbb>
<ccc>
<ddd attribute="boxtype_start"/>
</ccc>
<eee>box2_start</eee>
</bbb>
<bbb>
<ccc>
<ddd attribute="boxh1"/>
</ccc>
<eee>2_boxtitle_h1</eee>
</bbb>
<bbb>
<ccc>
<ddd attribute="boxh2">test</ddd>
</ccc>
<eee>2_boxtitle_h2</eee>
</bbb>
<bbb>
<ccc>
<ddd attribute="boxpara"/>
</ccc>
<eee>boxpara</eee>
</bbb>
<bbb>
<ccc>
<ddd attribute="boxtype_end"/>
</ccc>
<eee>box2_end</eee>
</bbb>
</aaa> <xsl:template match="/">
<xsl:apply-templates/>
</xsl:template> <xsl:template match="aaa">
<xsl:apply-templates/>
</xsl:template> <xsl:template match="bbb">
<xsl:if test="descendant::*[@attribute='boxh1']">
<title>
<xsl:apply-templates select="eee"/>
</title>
</xsl:if>
<xsl:if test="descendant::*[@attribute='boxh2']">
<subtitle>
<xsl:apply-templates select="eee"/>
</subtitle>
</xsl:if>
<xsl:if test="descendant::*[@attribute='boxpara']">
<para>
<xsl:apply-templates select="eee"/>
</para>
</xsl:if>
</xsl:template><?xml version="1.0" encoding="UTF-8"?> <box> <!-- box1_start --> <title>1_boxtitle_h1</title> <subtitle>1_boxtitle_h2</subtitle> <para>boxpara</para> </box
<box> <!-- box2_start --> <title>2_boxtitle_h1</title> <subtitle>2_boxtitle_h2</subtitle> <para>boxpara</para> </box>
Thanks in advance, Andreas
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] First and rest of body <p, Pankaj Chaturvedi | Thread | Re: [xsl] trying to create surround, David Carlisle |
| Re: [xsl] how do you count based on, Tony Zanella | Date | Re: [xsl] trying to create surround, David Carlisle |
| Month |