RE: [xsl] create xml from incoming xml and load it into a variable

Subject: RE: [xsl] create xml from incoming xml and load it into a variable
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 29 Jul 2008 11:52:13 +0100
Unfortunately the output of xsl:message is implementation-defined. Your XSLT
processor appears to be flattening it to a string, which I don't think is a
particularly good idea, but it's allowed by the spec. (Some processors
discard xsl:message output completely, which is also permitted.)

You can also view the variable by copying it temporarily to the result tree:

<debug variable="var">
  <xsl:copy-of select="$var"/>
</debug>

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: sudheshna iyer [mailto:sudheshnaiyer@xxxxxxxxx] 
> Sent: 29 July 2008 11:30
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] create xml from incoming xml and load it 
> into a variable
> 
> Thank you for the reply.
> 
> If I use 		
> 	<xsl:message>
> 		var: <xsl:copy-of select="$var"/>
> 	</xsl:message>	
> It only prints the following for the below mentioned xml:
> 
> 112005-08-26aaaaaaaaaa11111222005-08-26bbbbb112005-08-26ccccc1
> 12005-08-26dddddddddd11111
> 
> For the xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <root>    
>     <subroot id="11111">
>         <ccc>11</ccc>
>         <ddd>2005-08-26</ddd>
>         <eee>aaaaa</eee>
>          <eee>aaaaa11111</eee>
>     </subroot>
>     <subroot id="11111">
>         <ccc>22</ccc>
>         <ddd>2005-08-26</ddd>
>         <eee>bbbbb</eee>
>     </subroot>
>     <subroot id="11111">
>         <ccc>11</ccc>
>         <ddd>2005-08-26</ddd>
>         <eee>ccccc</eee>
>     </subroot>
>     <subroot id="11111">
>         <ccc>11</ccc>
>         <ddd>2005-08-26</ddd>
>         <eee>ddddd</eee>
>         <eee>ddddd11111</eee>        
>     </subroot>    
> </root> 
> 
> I want to see the complete xml, just like the input xml along 
> with element names.
> 
> For eg:
> <root>
> 	<ccc>11</ccc>
> 	<ddd>2005-08-26</ddd>
> 	<eee>aaaaa</eee>
> 	<eee>aaaaa11111</eee>
>          ...
>          
> with the hiearchy preserved. I am debugging larger xsl file 
> and I don't know whether result-tree in the memory is 
> constructed right or not.
> 
> Thank you.
> 
> 
> --- On Tue, 7/29/08, Florent Georges <lists@xxxxxxxxxxxx> wrote:
> 
> > From: Florent Georges <lists@xxxxxxxxxxxx>
> > Subject: Re: [xsl] create xml from incoming xml and load it into a 
> > variable
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Date: Tuesday, July 29, 2008, 5:57 AM
> > sudheshna iyer wrote:
> > 
> >   Hi
> > 
> > > In the below xsl, how do I see the entire xml that is
> > in
> > > variable "var"?
> > 
> >   What do you mean exactly?  If you want to "see"
> > it in the result
> > tree, use xsl:sequence or xsl:copy-of:
> > 
> >     <bla-bla>
> >        <xsl:copy-of select="$var"/>
> >     </bla-bla>
> > 
> >   If you want to "see" it on the console (or whatever your 
> environment 
> > directs messages to), for debugging purpose, you can use
> > xsl:messages:
> > 
> >     <xsl:message select="$var"/>
> >     <!-- or... -->
> >     <xsl:message>
> >        VAR: <xsl:copy-of select="$var"/>
> >     </xsl:message>
> > 
> >   Regards,
> > 
> > --drkm
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >      
> > 
> ______________________________________________________________________
> > _______
> > 
> > Envoyez avec Yahoo! Mail. Une boite mail plus intelligente 
> > http://mail.yahoo.fr

Current Thread