473,789 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XST converting XML to HTML question

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 "><ss:Data ss:Type="String "
xmlns="http://www.w3.org/TR/REC-html40">H<Sub>3 </Sub><Font>PO</Font><Sub>4
</Sub></ss:Data></Cell>

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

<Cell ss:StyleID="s24 "><ss:Data ss:Type="String "
xmlns="http://www.w3.org/TR/REC-html40">I<Sub>C C</Sub></ss:Data></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

Jul 20 '05 #1
1 3356
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></ss:Data></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 "><ss:Data ss:Type="String "
xmlns="http://www.w3.org/TR/REC-html40">H<Sub>3 </Sub><Font>PO</Font><Sub>4
</Sub></ss:Data></Cell>

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

<Cell ss:StyleID="s24 "><ss:Data ss:Type="String "
xmlns="http://www.w3.org/TR/REC-html40">I<Sub>C C</Sub></ss:Data></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


Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
29836
by: mickjames | last post by:
Hi, I'd like to include the whole web page content (as opposed to just the headlines) into RSS/XML to enable people to read them via rss feed readers. Question: how to convert HTML elements such as href, img, b, p, etc into XML? I've seen someone use the following in their RSS feed but I don't like it because <pre> doesn't produce a nice format:
4
2203
by: bbxrider | last post by:
sorry if this is the wrong newsgroup but not sure which html group it would be if really more a html question i'm trying to figure a way to enter a value for my form action target right on the webpage like this, <FORM method="Post" action="perl4.pl"......... i've tried setting a javascript variable to a value entered in a form textfield, and using that variable, eg. action=variableName, action=""variableName"", etc but can't seem to...
1
1380
by: abcd | last post by:
Very basic HTML question 1. I have image I want to display that to a button how can I do that. I want to fire the on click event too 2. if 1 is not possible then how can I set image to have oncclick event, currently I get object nbot found error code is like this <button ID ="Sel" name="Sel" OnClick="moveOptions(this.form.AvailableInd,
1
1801
by: darrel | last post by:
I have two issues: 1) The WYSIWYG content editor we're using for our CMS doesn't truly support xhtml. 2) .net doesn't truly support xhtml my question is if there is a .net library/class/component that can convert from html to xhtml?
1
984
by: Stu | last post by:
Hi, I need to find a method of converting html in to a PDF document on teh server. Can anyone suggest the best way of doing this? Thanks in advance, Stu
2
2289
by: Ben Amada | last post by:
Hello, A partner is going to be creating some HTML files that I plan on converting to user controls (UC) and dynamically load at runtime. I'm guessing Visual Studio doesn't come with some utililty to convert HTML files to UCs? IOW, I'll have to manually convert each HTML file to a UC? I've never used user controls before, so I'm wondering what I need to add and remove to each UC (or HTML file) to make this work. For instance, I...
9
6737
by: anupamjain | last post by:
Hi, After 2 weeks of search/hit-and-trial I finally thought to revert to the group to find solution to my problem.(something I should have done much earlier) This is the deal : On a JSP page, I want to grab a URL and parse /change the HTML and send it to the JSP page. I take the URL from the user in a textbox (not the
3
2130
by: varuna | last post by:
Hi, I have doubt on converting html page to .net i mean if i designed a page in frontpage or in a Dreamweaver so that page i mean instead of designing a web page in .net using toolbox i need to convert this html page as a .net web page. How to do that shal i open the html file in a .net or shal i copy the file into that folder, im confusing with that so please let me know and explain me briefly. Thanks in advance Varuna
1
2134
by: Software Engineer | last post by:
Testing htmlspecialchars() PHP Function - Converting HTML Characters http://sqa.fyicenter.com/Online_Test_Tools/Test_htmlspecialchars_PHP_Function.php When data needs to be presented in Web pages, HTML special characters must be well protected Otherwise, data well not be presented properly, or the Web will become corrupted. This page allows you to learn and test the htmlspecialchars() function to protect embedded data in Web pages.
6
12515
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
Is there a function in VS or a utility that will take an HTML file and create a code-behind ASPX page? The idea is, I'd like to be able to have someone develop beautiful, fully functional HTML pages and then pull them in and convert them to ASPX WebForms, doing a bunch of things like: Convert various standard html tags to <ASP:...equivalents, etc., etc. Any ideas?
0
10400
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10189
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10132
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9010
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6754
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5412
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5544
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2902
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.