Groups > Design > Microsoft xsl > Re: XMl with html tags to Excel?




XMl with html tags to Excel?

XMl with html tags to Excel?
Fri, 21 Mar 2008 10:04:05 -050
I have data in xml that has some html within the elements, I have an xsl 
file that works for performing a transform to excel pretty well.

The output to excel just outputs the html in data in its raw 
form...(non-rendered).  Is it possible to have that data actually rendered 
like the html would have rendered it?

ie.

sample XML
<data>
    <item><b>BOLD<b></item>  (ignore the non-escaped
character for examples 
sake)
</data>

portion of a sample xsl:
<Row>
<Cell ss:StyleID="s80"><data ss:Type="string">
<xsl:value-of 
select="item"/></Data></Cell>
</Row>

The Resuting data in my spread sheet is literally
"<b>BOLD</b>" as opposed 
to the text being bolded.

Is it possible to go straight from html data to the correpsonding format in 
excel?

Thank you,

FredB


Post Reply
Re: XMl with html tags to Excel?
Fri, 21 Mar 2008 16:15:08 +010
FredB wrote:

> <data>
>     <item><b>BOLD<b></item>  (ignore the
non-escaped character for examples 
> sake)
> </data>
> 
> portion of a sample xsl:
> <Row>
> <Cell ss:StyleID="s80"><data
ss:Type="string"> <xsl:value-of 
> select="item"/></Data></Cell>
> </Row>
> 
> The Resuting data in my spread sheet is literally
"<b>BOLD</b>" as opposed 
> to the text being bolded.
> 
> Is it possible to go straight from html data to the correpsonding format in

> excel?

I don't know whether Excel recognizes HTML elements like 'b', you would 
have to ask in an Excel group.
If you want to transform those HTML elements then don't use 
<xsl:value-of select="item"/>, instead use
<xsl:apply-templates 
select="item"/>
and make sure you write templates to transform e.g. 'b' to the 
corresponding Excel markup e.g.
   <xsl:template match="b">
     <!-- put Excel markup here -->
       <xsl:apply-templates/>
     <!-- put Excel markup here -->
   </xsl:template>

-- 

	Martin Honnen --- MVP XML
Post Reply
about | contact