[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Problem turning a xml string into a proper tree


Subject: RE: [xsl] Problem turning a xml string into a proper tree
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 3 Feb 2004 20:27:54 -0000

> I have tried :
> 
> <xsl:variable name="v" 
> select="xalan:nodeset('&lt;entity&gt;hallo&lt;/entity&gt;')"/>
> <xsl:value-of select="$v"/>
> 
>                     this returns <entity>hallo </entity>

I can't see how this relates to what you said you were doing earlier.

I'm not sure what xalan:nodeset does when given a string argument; I
expect it creates a tree and makes the string a text node within that
tree, and this is consistent with your output. What it won't do, almost
certainly, is to parse the string on the assumption that it contains
XML.

It would really help if you told us what problem you were trying to
solve, rather than showing us non-working code that represents your
attempt to solve it.

Michael Kay

> 
> 
> 
> Michael Kay wrote:
> 
> >>I have a template that  receives a parameter  that way:
> >>    <xsl:with-param name="paramString">
> >>        <params>
> >>            <param att="att1" name="name11">value1</param>
> >>            <param att="att2" name="name12">value2</param>
> >>
> >>                .........
> >>          </params>
> >>    </xsl:with-param>
> >>
> >>What I'd like to is  to retrieve the value of  <xsl:value-of
> >>select="$paramString/param[n]/@name" /> 
> >>    
> >>
> >
> >To do that in XSLT 1.0 you need the node-set() extension:
> >
> >select="xx:node-set($paramString)/param[n]/@name"
> >
> > 
> >  
> >
> >>What it more if i make <xsl:value-of select="$paramString"/>
> >> it should 
> >>return value1value2 but it returns        
> >>        <params>
> >>            <param att="att1" name="name11">value1</param>
> >>            <param att="att2" name="name12">value2</param>
> >>
> >>                .........
> >>          </params>
> >>this means xalan treats it as a string instead of a tree as
> >>I'd like to.
> >>
> >>    
> >>
> >
> ><xsl:value-of select="$paramString"/>
> >
> >should indeed return the string "value1value2". I'm very 
> surprised if 
> >it returns a string containing angle brackets. You need to show us a 
> >complete stylesheet that demonstrates the problem.
> >
> >Michael Kay
> >
> >
> > XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
> >
> >  
> >
> 
> 
> 
> 
> AVISO LEGAL
> Este mensaje de correo electrónico y sus documentos adjuntos 
> están dirigidos exclusivamente a los destinatarios 
> especificados. Puede contener información confidencial o 
> legalmente protegida. No hay renuncia a la confidencialidad o 
> privilegio por cualquier transmisión errónea. Si usted no es 
> el destinatario indicado, le rogamos que lo elimine y se lo 
> comunique al remitente. No debe, directa o indirectamente, 
> usar, revelar, distribuir, imprimir o copiar 
> ninguna de las partes de este mensaje. Si siendo destinatario de este 
> mensaje no consintiera el uso de correo electrónico, rogamos nos lo 
> comunique inmediatamente.
> Bancoval,S.A. y sus filiales no serán responsables de las 
> opiniones o informaciones incluidas en este mensaje salvo 
> cuando el remitente esté 
> autorizado para establecer que dichas opiniones proceden de 
> Bancoval,S.A y sus filiales.
> 
> DISCLAIMER
> Addressee/s identified herein. It may contain confidential or legally 
> privileged information. No confidentiality privilege is 
> waived or lost by any mistransmission. If you are not the 
> intended recipient, please immediately delete it and notify 
> the sender. You must not, directly or indirectly, disclose, 
> distribute, print, or copy any part of this message. If you 
> are the addressee of this message and do not consent to the 
> use of e-mail, please communicate it to us immediately. 
> Bancoval, S.A. and its subsidiaries are not responsible for 
> the opinions or information included in this message except 
> when the sender is authorised to state them to be the views 
> of Bancoval, S.A and its subsidiaries.
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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



Current Thread
Keywords