[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

xsl variables, again

Subject: xsl variables, again
From: emunioz@xxxxxxxxx
Date: Thu, 16 Sep 1999 09:20:18 +0200
agencia xsl
The matter is :
I have a XML document

<berman>
<HAN etiqueta="HAN" instrucc_cod="2" >
</HAN>
<NAD2 etiqueta="NAD" califica_interesado="TR" id_interesado="A48085452"
califica_lista="167" agencia="148" entidad="RO RO TERMINAL" >
</NAD2>
<GDS etiqueta="GDS" tipo_carga="GP" >
</GDS>
<MEA3 etiqueta="MEA" califica_medidas="WT" valor="TNE" >
</MEA3>
<HAN etiqueta="HAN" instrucc_cod="1" >
</HAN>
<NAD2 etiqueta="NAD" califica_interesado="TR" id_interesado="A48085453"
califica_lista="167" agencia="148" entidad="RO RO TERMINAL" >
</NAD2>
<GDS etiqueta="GDS" tipo_carga="GP" >
</GDS>
<MEA3 etiqueta="MEA" califica_medidas="WT" valor="TNE" >
</MEA3>
</berman>

and I want to make a XSL file to transform the initial XML to another
one like this

<berman>
<HAN><etiqHAN etiqueta="HAN"/><grHAN1 instrucc_cod="2" vacio1=""
vacio2="" instrucc=""/></HAN>
<NAD2><etiqNAD etiqueta="NAD"/><grNAD1 califica_interesado="TR"/><grNAD2
id_interesado="A48085452" califica_lista="167" agencia="148"/><grNAD3
vacio=""/><grNAD4 entidad="RO RO TERMINAL"/></NAD2>
<GDS><etiqGDS etiqueta="GDS"/><grGDS1 tipo_carga="GP"/></GDS>
<MEA2><etiqMEA etiqueta="MEA"/><grMEA1 califica_medidas="WT"/><grMEA2
dimensiones=""/><grMEA3 unidad="" valor="TNE"/></MEA2>
<HAN><etiqHAN etiqueta="HAN"/><grHAN1 instrucc_cod="1" vacio1=""
vacio2="" instrucc=""/></HAN>
<NAD2><etiqNAD etiqueta="NAD"/><grNAD1 califica_interesado="TR"/><grNAD2
id_interesado="A48085453" califica_lista="167" agencia="148"/><grNAD3
vacio=""/><grNAD4 entidad="RO RO TERMINAL"/></NAD2>
<GDS><etiqGDS etiqueta="GDS"/><grGDS1 tipo_carga="GP"/></GDS>
<MEA2><etiqMEA etiqueta="MEA"/><grMEA1 califica_medidas="WT"/><grMEA2
dimensiones=""/><grMEA3 unidad="" valor="TNE"/></MEA2>
</berman>

The XSL file I use is

<xsl:for-each select="berman/HAN">
  <HAN>
 <etiqHAN><xsl:attribute name="etiqueta"><xsl:value-of
select="@etiqueta"/></xsl:attribute></etiqHAN>
  <grHAN1>
 <xsl:attribute name="instrucc_cod"><xsl:value-of
select="@instrucc_cod"/></xsl:attribute>
 <xsl:attribute name="vacio1"><xsl:value-of
select="@vacio1"/></xsl:attribute>
 <xsl:attribute name="vacio2"><xsl:value-of
select="@vacio2"/></xsl:attribute>
 <xsl:attribute name="instrucc"><xsl:value-of
select="@instrucc"/></xsl:attribute>
  </grHAN1>
  </HAN>
   <xsl:for-each select="//NAD2">
  <NAD2>
 <etiqNAD><xsl:attribute name="etiqueta"><xsl:value-of
select="@etiqueta"/></xsl:attribute></etiqNAD>
  <grNAD1>
 <xsl:attribute name="califica_interesado"><xsl:value-of
select="@califica_interesado"/></xsl:attribute>
  </grNAD1>
  <grNAD2>
 <xsl:attribute name="id_interesado"><xsl:value-of
select="@id_interesado"/></xsl:attribute>
 <xsl:attribute name="califica_lista"><xsl:value-of
select="@califica_lista"/></xsl:attribute>
 <xsl:attribute name="agencia"><xsl:value-of
select="@agencia"/></xsl:attribute>
  </grNAD2>
  <grNAD3>
 <xsl:attribute name="vacio"><xsl:value-of
select="@vacio"/></xsl:attribute>
  </grNAD3>
  <grNAD4>
 <xsl:attribute name="entidad"><xsl:value-of
select="@entidad"/></xsl:attribute>
  </grNAD4>
  </NAD2>
  </xsl:for-each>
 <xsl:for-each select="//GDS">
  <GDS>
 <etiqGDS><xsl:attribute name="etiqueta"><xsl:value-of
select="@etiqueta"/></xsl:attribute></etiqGDS>
  <grGDS1>
 <xsl:attribute name="tipo_carga"><xsl:value-of
select="@tipo_carga"/></xsl:attribute>
  </grGDS1>
  </GDS>
  </xsl:for-each>
 <xsl:for-each select="//MEA2">
  <MEA2>
 <etiqMEA><xsl:attribute name="etiqueta"><xsl:value-of
select="@etiqueta"/></xsl:attribute></etiqMEA>
  <grMEA1>
 <xsl:attribute name="califica_medidas"><xsl:value-of
select="@califica_medidas"/></xsl:attribute>
  </grMEA1>
  <grMEA2>
 <xsl:attribute name="dimensiones"><xsl:value-of
select="@dimensiones"/></xsl:attribute>
  </grMEA2>
  <grMEA3>
 <xsl:attribute name="unidad"><xsl:value-of
select="@unidad"/></xsl:attribute>
 <xsl:attribute name="valor"><xsl:value-of
select="@valor"/></xsl:attribute>
  </grMEA3>
  </MEA2>
  </xsl:for-each>

and what I get is

HAN
HAN
NAD2
NAD2
GDS
GDS
MEA2
MEA2

but I should get

HAN
NAD2
GDS
MEA2
HAN
NAD2
GDS
MEA2

Thanks in advance.


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.