XSL - especificar la rutas o los atributes de los elemen

 
Vista:
sin imagen de perfil

especificar la rutas o los atributes de los elemen

Publicado por dayni (11 intervenciones) el 18/05/2009 21:17:31
Estoy trabajando un una aplicación para general xsl mi problema es que me hace falta especificar la rutas o los atributes de los elementos xsl a través de parámetro que después le envió el valor desde la aplicación. Por ejemplo
Código
Xml sencillo
<?xml version="1.0" encoding="UTF-8"?>
<WSGetRealName xmlns="http://wslora.com/">
<DataBaseName>string</DataBaseName>
<port>int</port>
<user>string</user>
<pasword>string</pasword>
<ResourceUri>string</ResourceUri>
</WSGetRealName>

VB.Net
Dim argList As XsltArgumentList = New XsltArgumentList()

Dim valoraux As String = "@xmlns"
argList.AddParam("valor", "", valoraux)
Xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:output method="xml"/>

<xsl:param name="valor"/>

<xsl:template match="/">
<xsl:value-of select="$valor" /> lo que yo creo que debería hacer es sacar el valor del atributo @xmlns que sería http://wslora.com/ y lo que saca es @xmlns
</xsl:template>
</xsl:stylesheet>

Si alguien supiera y pudiera darme una ayudita le agradecería.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:especificar la rutas o los atributes de los ele

Publicado por Didi-chan (7 intervenciones) el 19/05/2009 08:54:33
Creo que deberias ponerlo directamente el atributo en el value-of...si te llega el xml es mas sencillo que todo eso de meterlo en una variable y todo ¿no? Porque creo que lo que estas haciendo arriba es meterle el literal, no el valor del atributo.

<xsl:value-of select=" @xmlns" />
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

RE:especificar la rutas o los atributes de los ele

Publicado por dayni (11 intervenciones) el 19/05/2009 19:01:56
El problema es que podría ser un XML cualquiera que yo de antemano no se cual es el atributo o valor que quiere sacar por eso lo estoy pasando como parámetro las rutas o las direcciones que desde la aplicación el usuario me especifica que es lo que quiere lo que no se si esto podrá ser posible, por ejemplo otra prueba que hice.
Código
Xml sencillo
<?xml version="1.0" encoding="UTF-8"?>
<WSGetRealName xmlns="http://wslora.com/">
<DataBaseName>string</DataBaseName>
<port>int</port>
<user>string</user>
<pasword>string</pasword>
<ResourceUri>string</ResourceUri>
</WSGetRealName>

VB.Net
Dim rutaaux As String = "/WSGetRealName"
Dim valoraux As String = "@xmlns"
argList.AddParam("ruta", "", rutaaux)
argList.AddParam("valor", "", valoraux)
Xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:output method="xml"/>

<xsl:param name="ruta"/>
<xsl:param name="valor"/>

<xsl:template match="ruta">
<xsl:value-of select="$valor" />
</xsl:template>
</xsl:stylesheet>

Esta vez lo que me devuelve es
string
int
string
string
string
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:especificar la rutas o los atributes de los ele

Publicado por Didi-chan (7 intervenciones) el 20/05/2009 17:32:00
Pues no se si te resultará pero prueba a ver, como lo tenias al principio que te acuerdas que te devolvia "@xmlns"? Pues igual, pero cuando asignes la cadena hazlo de esta manera:

Dim valor As String = "{@xmlns}"

Con las llaves, a mi me funciona para meter valores del xml en hrefs. Prueba y me cuentas.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

RE:especificar la rutas o los atributes de los ele

Publicado por dayni (11 intervenciones) el 20/05/2009 20:16:20
gracias por responderme pero no funciona ahora debuelbe {@xmlns} nose porque pasara esto normalmente si tu pones "@xmlns" Expresión XPath que hace referencia al ATRIBUTO "xmlns" y si pones "{@xmlns}" Permite aplicar al atributo de un elemento cualquiera (NO xsl:*) el valor de un atributo directamente. Pero nose porque motivo no quiere funcionar cuando lo hago con un parametro que está tomando lo mismo @xmlns no pasa. Si tienes algun manual que reconmendarme.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:especificar la rutas o los atributes de los ele

Publicado por Didi-chan (7 intervenciones) el 21/05/2009 08:48:07
Pues vaya...Yo es que tampoco es que sepa mucho de xsl ¿sabes? lo vi por primera vez hace 2 semanas y tampoco es que hiciera grandes cosas con el. Y manuales tampoco se, el analista de mi empresa me recomendó esto pero no se si te valdrá si ya estás avanzado en el tema:

http://xml.utilitas.org/xslt_mini_como.html

Siento no poder ayudarte :(
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:especificar la rutas o los atributes de los ele

Publicado por Didi-chan (7 intervenciones) el 21/05/2009 08:50:42
Ah, prueba suerte en estos otros foros si no lo has intentado, te contestan bastante rápido y puede que sepan solucionar tu problema.

http://www.forosdelweb.com

http://www.chw.net/foro/lenguajes-de-programacion-f22/
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

RE:especificar la rutas o los atributes de los ele

Publicado por dayni (11 intervenciones) el 21/05/2009 16:02:51
gracias de todas formas yo también empese hace poco el manual que me recomiendas ya lo lei pero no importa ya cambien de idea voy a general xsl con la información sin pasarle parametros porque ya hice las pruebas pertinentes y con parametros no me funciona.
Gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:especificar la rutas o los atributes de los ele

Publicado por monica (2 intervenciones) el 25/09/2009 01:32:01
<?xml version="1.0" ?>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <!-- localized strings
-->
<xsl:variable name="ColumnHeader_Date">Fecha</xsl:variable>
<xsl:variable name="ColumnHeader_Time">Hora</xsl:variable>
<xsl:variable name="ColumnHeader_From">De</xsl:variable>
<xsl:variable name="ColumnHeader_To">Para</xsl:variable>
<xsl:variable name="ColumnHeader_Message">Mensaje</xsl:variable>
- <!-- variables
-->
<xsl:variable name="Debug">0</xsl:variable>
<xsl:variable name="TableStyle">font-family:Segoe UI; font-size:75%; text-align:left; vertical-align:top; table-layout:fixed</xsl:variable>
<xsl:variable name="GutterStyle">width:2ex</xsl:variable>
<xsl:variable name="HeaderStyle">border-bottom:1 solid black</xsl:variable>
<xsl:variable name="UseZebraStripe">1</xsl:variable>
<xsl:variable name="ZebraStripeStyle">background-color:#e0edff</xsl:variable>
<xsl:variable name="MostRecentSessionFirst">0</xsl:variable>
- <xsl:template match="Log">
- <html dir="ltr">
- <head>
- <title>
Message Log for
<xsl:value-of select="@LogonName" />
<xsl:if test="$Debug = 1">(Debug)</xsl:if>
</title>
- <xsl:if test="$Debug = 1">
<span style="font-family:trebuchet ms; font-size:120%">Debug Version</span>
<hr />
</xsl:if>
</head>
- <body style="margin:0">
- <table id="BodyTable" style="{$TableStyle}" cellspacing="0">
- <xsl:if test="$Debug = 1">
<col style="vertical-align:top; width:5ex;" />
<col style="{$GutterStyle}" />
</xsl:if>
<col style="width:16ex;" />
<col style="{$GutterStyle}" />
<col style="width:16ex;" />
<col style="{$GutterStyle}" />
<col style="width:21ex;" />
<col style="{$GutterStyle}" />
<col style="width:21ex;" />
<col style="{$GutterStyle}" />
<col style="width:70ex;" />
- <thead>
- <tr>
- <xsl:if test="$Debug = 1">
<th style="{$HeaderStyle}">SID</th>
<th />
</xsl:if>
- <th style="{$HeaderStyle}">
<xsl:value-of select="$ColumnHeader_Date" />
</th>
<th />
- <th style="{$HeaderStyle}">
<xsl:value-of select="$ColumnHeader_Time" />
</th>
<th />
- <th style="{$HeaderStyle}">
<xsl:value-of select="$ColumnHeader_From" />
</th>
<th />
- <th style="{$HeaderStyle}">
<xsl:value-of select="$ColumnHeader_To" />
</th>
<th />
- <th style="{$HeaderStyle}">
<xsl:value-of select="$ColumnHeader_Message" />
</th>
</tr>
</thead>
- <tbody style="vertical-align:top">
- <xsl:choose>
- <!-- newest session first
-->
- <xsl:when test="$MostRecentSessionFirst = 1">
- <xsl:apply-templates>
<xsl:sort select="@SessionID" order="descending" data-type="number" />
<xsl:sort select="@DateTime" order="ascending" />
</xsl:apply-templates>
</xsl:when>
- <!-- oldest session first
-->
- <xsl:otherwise>
- <xsl:apply-templates>
<xsl:sort select="@SessionID" order="ascending" data-type="number" />
<xsl:sort select="@DateTime" order="ascending" />
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</tbody>
</table>
</body>
</html>
</xsl:template>
- <xsl:template match="Message">
- <tr>
<xsl:call-template name="CommonMessageProcessing" />
- <td>
<xsl:apply-templates select="From/User" />
</td>
<td />
- <td>
<xsl:apply-templates select="To/User" />
</td>
<td />
- <td>
- <span>
- <xsl:attribute name="style">
<xsl:value-of select="Text/@Style" />
</xsl:attribute>
<xsl:value-of select="Text" />
</span>
</td>
</tr>
</xsl:template>
- <xsl:template match="Invitation|InvitationResponse|Join|Leave">
- <tr>
<xsl:call-template name="CommonMessageProcessing" />
<td />
- <!-- From
-->
<td />
<td />
- <!-- To
-->
<td />
- <td>
- <span>
- <xsl:attribute name="style">
<xsl:value-of select="Text/@Style" />
</xsl:attribute>
<xsl:value-of select="Text" />
</span>
</td>
</tr>
</xsl:template>
- <xsl:template match="User">
- <!-- add a comma before all but the first user
-->
<xsl:if test="position() != 1">,</xsl:if>
<xsl:value-of select="@FriendlyName" />
</xsl:template>
- <xsl:template name="CommonMessageProcessing">
- <!-- zebra-stripe the sessions
-->
- <xsl:if test="$UseZebraStripe = 1">
- <xsl:if test="(@SessionID mod 2) = 1">
- <xsl:attribute name="style">
<xsl:value-of select="$ZebraStripeStyle" />
</xsl:attribute>
</xsl:if>
</xsl:if>
- <xsl:if test="$Debug = 1">
- <td>
<xsl:value-of select="@SessionID" />
</td>
<td />
</xsl:if>
- <td>
<xsl:value-of select="@Date" />
</td>
<td />
- <td>
<xsl:value-of select="@Time" />
</td>
<td />
</xsl:template>
</xsl:stylesheet>
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:especificar la rutas o los atributes de los ele

Publicado por virginia (1 intervención) el 08/02/2011 00:34:10
hola nesesito saber k dice un historial les dejo mi correo gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar