Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XST converting XML to HTML question

Reply
Thread Tools

XST converting XML to HTML question

 
 
Bill Sneddon
Guest
Posts: n/a
 
      07-15-2003
I am using an XML file produced by doing a save-as in Excel. The file
has content that looks like one of these three examples lines:

<Cell ss:StyleID="s24"><ssata ss:Type="String"
xmlns="http://www.w3.org/TR/REC-html40">H<Sub>3</Sub><Font>PO</Font><Sub>4
</Sub></ssata></Cell>

<Cell ss:StyleID="s24"><Data ss:Type="String">GC</Data></Cell>

<Cell ss:StyleID="s24"><ssata ss:Type="String"
xmlns="http://www.w3.org/TR/REC-html40">I<Sub>CC</Sub></ssata></Cell>


What I would like to do is produce html that formats the subscript
properly. For example I would like to display H3PO4 with the 3 & 4
subscripted like this H<Sub>3</Sub><Font>PO</Font><Sub>4</Sub>

when I do this select <xsl:value-of select="Cell[1]"/>
I get H3PO4 back. I<Sub>CC</Sub> would also be valid data so
I can't make assuptions about the number of <Sub> tags and where they
might be in the data.

I am not sure if the solution to this is easy or not. I still trying to
understand XSL and may be overlooking something.



Bill

 
Reply With Quote
 
 
 
 
Bill Sneddon
Guest
Posts: n/a
 
      07-18-2003
I could not make this work at all.
I finally had to convert <Sub> -> &lt;Sub&gt;
Do the transform and convert it back.

It still seems possible but I could not get it to work after many attempts.

In your example below what causes the H and the 3 to be outputed?
I am currently working in a for-each loop but had the same results
when trying to apply templates.

<Data>H<Sub>3</Sub><Font>PO</Font><Sub>4
</Sub></ssata></Cell>


Bill

Peter Flynn wrote:
> Bill Sneddon wrote:
>
>> I am using an XML file produced by doing a save-as in Excel. The file
>> has content that looks like one of these three examples lines:
>>
>> <Cell ss:StyleID="s24"><ssata ss:Type="String"
>> xmlns="http://www.w3.org/TR/REC-html40">H<Sub>3</Sub><Font>PO</Font><Sub>4
>> </Sub></ssata></Cell>
>>
>> <Cell ss:StyleID="s24"><Data ss:Type="String">GC</Data></Cell>
>>
>> <Cell ss:StyleID="s24"><ssata ss:Type="String"
>> xmlns="http://www.w3.org/TR/REC-html40">I<Sub>CC</Sub></ssata></Cell>
>>
>>
>> What I would like to do is produce html that formats the subscript
>> properly. For example I would like to display H3PO4 with the 3 & 4
>> subscripted like this H<Sub>3</Sub><Font>PO</Font><Sub>4</Sub>
>>
>> when I do this select <xsl:value-of select="Cell[1]"/>
>> I get H3PO4 back.

>
>
> That's because value-of gives you the string content, stripped
> of any internal markup. You need to write a template for Cell
> and for Sub:
>
> <xsl:template match="Cell">
> <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="Sub">
> <sub>
> <xsl:apply-templates/>
> </sub>
> </xsl:apply-templates>
>
> ///Peter
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: True dual-port RAM in VHDL: XST question Fredxx VHDL 29 06-30-2009 02:24 PM
Problem to insert an XML-element by XSLT-converting from one XML-file into another XML-file jkflens XML 2 05-30-2006 09:41 AM
Newbie question: Converting XML into PDF or HTML niels XML 3 10-01-2003 04:51 PM
XST fails to recognize FSM with registered outputs E. Backhus VHDL 2 07-25-2003 07:48 AM
XST Process Failure Jeremy Pyle VHDL 0 07-14-2003 04:35 AM



Advertisments