Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/12/2003, 03:01
mani14
 
Fecha de Ingreso: julio-2003
Mensajes: 17
Antigüedad: 20 años, 9 meses
Puntos: 0
prblemas al crear xml

hola a todos:
Tengo el siguiente problema, estoy intentando generar un archivo XML a partir de otro XML ayudandome de un XSL. el problema esta en que no se como se hace. lo he intentadado de esta forma,
XSL

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- Siguiente paso va a ser el saber como generar codigo xml a partir de un xml -->
<xsl:template match="/window">
<xsl:variable name="wid">
<xsl:value-of select="@idwin"/>
</xsl:variable>
<xsl:variable name="wtitle">
<xsl:value-of select="title"/>
</xsl:variable>
<xsl:variable name="worient">
<xsl:value-of select="orient"/>
</xsl:variable>
<window id="$wid" title="$wtitle" orient="$worient" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<xsl:apply-templates select="boton"/>
<xsl:apply-templates select="etiqueta"/>
</window>
</xsl:template>
<xsl:template match="boton">
<xsl:variable name="bid">
<xsl:value-of select="@idboton"/>
</xsl:variable>
<xsl:variable name="bclase">
<xsl:value-of select="clase"/>
</xsl:variable>
<xsl:variable name="blabel">
<xsl:value-of select="label"/>
</xsl:variable>
<xsl:variable name="bdefault">
<xsl:value-of select="default"/>
</xsl:variable>
<xsl:variable name="btecla">
<xsl:value-of select="teclacceso"/>
</xsl:variable>
<button id="$bid" class="$bclase" label="$blabel" default="$bdefault" accesskey="$tecla"/>
</xsl:template>
<xsl:template match="etiqueta">
<xsl:variable name="lvalue">
<xsl:value-of select="value"/>
</xsl:variable>
<xsl:variable name="lcontrol">
<xsl:value-of select="control"/>
</xsl:variable>
<label value="$lvalue" control="$lcontrol"/>
</xsl:template>
</xsl:stylesheet>


Y el XML es :

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="C:\Documents and Settings\mani14f\Escritorio\pfc\pfcxml\prueba3.xsl "?>
<window xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\Documents and Settings\mani14f\Escritorio\pfc\pfcxml\prueba2.xsd " idwin="idwin1">
<title>La puta de la variable</title>
<orient>vertical</orient>
<boton idboton="idb1">
<clase>dialog</clase>
<label>miBoton</label>
<default>true</default>
<teclacceso>t</teclacceso>
</boton>
<boton idboton="idb2">
<clase>dialog</clase>
<label>miBoton2</label>
<default>false</default>
<teclacceso>q</teclacceso>
</boton>
<etiqueta>
<value>Hola</value>
<control>idb1</control>
</etiqueta>
</window>


Ya siento me ter tanto codigo, pero sino no me se explicar. espero me hallan entendido la pregunta, si tienen alguna duda me preguntan y yo se la contesto.
En realiadad lo que quiero conseguir es un archivo xul pero éste es xml.
Hay alguna forma con un xsl para escribir en un archivo que hallamos creado?

Gracias a todos.