Foros del Web » Programación para mayores de 30 ;) » Programación General »

XML - XSL Add Number line in Attributes problem

Estas en el tema de XML - XSL Add Number line in Attributes problem en el foro de Programación General en Foros del Web. hi, i wanna to add the number of the line in my tree... I wish to do that with attributes as __line=" " I guess ...
  #1 (permalink)  
Antiguo 15/04/2008, 13:05
 
Fecha de Ingreso: abril-2008
Mensajes: 11
Antigüedad: 16 años
Puntos: 0
XML - XSL Add Number line in Attributes problem

hi, i wanna to add the number of the line in my tree...

I wish to do that with attributes as __line=" "




I guess I need an accountant but not how to do it:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

<xsl:template match="//*">
<xsl:copy>
<xsl:attribute name="__line">
<!--COUNT -->
</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>



<inventory __line="1">
<book year="2000" __line="2">
<title __line="3">Snow Crash</title>
<author __line="4">Neal Stephenson</author>
<publisher __line="5">Spectra</publisher>
<isbn __line="6">0553380958</isbn>
<price __line="7">14.95</price>
</book>

<book year="2005" __line="8">
<title __line="9">Burning Tower</title>
<author __line="10">Larry Niven</author>
<author __line="11">Jerry Pournelle</author>
<publisher __line="12">Pocket</publisher>
<isbn __line="13">0743416910</isbn>
<price __line="14">5.99</price>
</book>

<book year="1995" __line="14">
<title __line="16">Zodiac</title>
<author __line="17">Neal Stephenson</author>
<publisher __line="18">Spectra</publisher>
<isbn __line="19">0553573862</isbn>
<price __line="20">7.50</price>
</book>

<!-- more books... -->
</inventory>



Thx and if any can send my the result to [email protected]

Bye
  #2 (permalink)  
Antiguo 15/04/2008, 13:15
Avatar de aloqui  
Fecha de Ingreso: diciembre-2007
Mensajes: 973
Antigüedad: 16 años, 5 meses
Puntos: 24
Re: XML - XSL Add Number line in Attributes problem

I'm not sure, but you can try with "<xsl:number />" instead of "<!--COUNT -->"
__________________
Grupos de Música
Pop Music Stars
  #3 (permalink)  
Antiguo 16/04/2008, 10:36
 
Fecha de Ingreso: abril-2008
Mensajes: 11
Antigüedad: 16 años
Puntos: 0
Re: XML - XSL Add Number line in Attributes problem

I try to do that but this <xsl:number /> Inserts a number but discriminate levels of the nodes


If compiling this program becomes well...

[COLOR="Red"]<CATALOG __line="1">
<CD __line="1">
<TITLE __line="1">"Empire Burlesque"</TITLE>
<ARTIST __line="2">Bob Dylan</ARTIST>
<COUNTRY __line="3">USA</COUNTRY>
<COMPANY __line="4">Columbia</COMPANY>
<PRICE __line="5">10.90</PRICE>
<YEAR __line="6">1985</YEAR>
</CD>
<CD __line="2">
<TITLE __line="1">"Juan Pablo 2"</TITLE>
<ARTIST __line="2">Holy Water</ARTIST>
<COUNTRY __line="3">Baticano</COUNTRY>
<COMPANY __line="4">Italy</COMPANY>
<PRICE __line="5">10.90</PRICE>
<YEAR __line="6">1985</YEAR>
</CD>
</CATALOG> [/COLOR>


but i need that
<CATALOG __line="1">
<CD __line="2">
<TITLE __line="3">"Empire Burlesque"</TITLE>
<ARTIST __line="4">Bob Dylan</ARTIST>
<COUNTRY __line="5">USA</COUNTRY>
<COMPANY __line="6">Columbia</COMPANY>
<PRICE __line="7">10.90</PRICE>
<YEAR __line="8">1985</YEAR>
</CD>
<CD __line="9">
<TITLE __line="10">"Juan Pablo 2"</TITLE>
<ARTIST __line="11">Holy Water</ARTIST>
<COUNTRY __line="12">Baticano</COUNTRY>
<COMPANY __line="13">Italy</COMPANY>
<PRICE __line="14">10.90</PRICE>
<YEAR __line="15">1985</YEAR>
</CD>
</CATALOG>



Thank for all
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:54.