RE: RE: [xsl] ordering problem

Subject: RE: RE: [xsl] ordering problem
From: cknell@xxxxxxxxxx
Date: Tue, 03 Feb 2004 13:42:07 -0500
Be sure to reply to the list and not directly to the reader. I'll reproduce your earlier reply here:

> No, i can do this, but my problem with ordering still the same. 

I took your fragment and turned it into well-formed XML:

<?xml version="1.0" encoding="UTF-8" ?>
<layout>
    <fact>preco_da_chamada</fact>
    <group id="grupo">
      <fact>bonus_atr_medio</fact>
      <fact>desconto</fact>
      <fact>montante_desc_medio</fact>
    </group>
    <fact>montante_medio</fact>
</layout>

You didn't publish the templates that match "fact" and "group" so I prepared templates to illustrate my point. Here is the stylesheet I used:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output method="text" indent="yes" encoding="UTF-8" />

  <xsl:template match="/">
    <xsl:apply-templates />
  </xsl:template>

  <xsl:template match="layout">
    <xsl:apply-templates />
  </xsl:template>

  <xsl:template match="fact">
    This is a fact: <xsl:value-of select="." />
  </xsl:template>

  <xsl:template match="group">
    This is a group: <xsl:value-of select="@id" />
    Here are the facts:
    <xsl:apply-templates />
  </xsl:template>

</xsl:stylesheet>

Here is the output I got:

    This is a fact: preco_da_chamada
    This is a group: grupo
    Here are the facts:
    This is a fact: bonus_atr_medio
    This is a fact: desconto
    This is a fact: montante_desc_medio
    This is a fact: montante_medio

The output is in document order. Please explain show what you are doing that produces output that is NOT in document order.
-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     cknell@xxxxxxxxxx
Sent:     Tue, 03 Feb 2004 12:22:34 -0500
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  RE: [xsl] ordering problem

Is there a reason why you don't replace this:
	<xsl:template match="report:layout">
	    <xsl:apply-templates select="report:group"/>
	    <xsl:apply-templates select="report:fact"/>
	</xsl:template>

With this?:
	<xsl:template match="report:layout">
	    <xsl:apply-templates/>
	</xsl:template>

-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Márcio Ferreira <mferreira@xxxxxxxxx>
Sent:     03 Feb 2004 17:12:30 +0000
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  [xsl] ordering problem

Hello,
I am writing a stylesheet for processing one xml-document like that: 
<layout>
    <fact>preco_da_chamada</fact>
    <group id="grupo">
      <fact>bonus_atr_medio</fact>
      <fact>desconto</fact>
      <fact>montante_desc_medio</fact>
    </group>
    <fact>montante_medio</fact>

i want to processe this document orderly, and in my stylesheet i have:
	<xsl:template match="report:layout">
	    <xsl:apply-templates select="report:group"/>
	    <xsl:apply-templates select="report:fact"/>
	</xsl:template>

i.e. the xml is processed in this order, first the groups and then the
facts, and i want this to processe it in the same order as i have in my
xml-document.


Any hint?
Thank you in advance,
Márcio



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread