473,324 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

How to transform 2

Hello! I've posted few days before a message:
How to transform:
<html>
<h1>title</h1>
<h2>header1</h2>
Content
<h3>subeader1</h3>
Subcontent
</html>

to:
<newsletter>
<title>title</title>
<section header="header1">
Content
<subsection header="subheader1">
Subcontent
</subsection>
</section>
</newsletter>

I've received an answer, but I think it isn't what I meant.

Details:
Note, that first file:
<html>
<h1>title</h1>
<h2>header1</h2>
Content
<h3>subeader1</h3>
Subcontent
<h3>subeader2</h3>
Subcontent
<h2>header2</h2>
Content
<h3>subeader3</h3>
Subcontent
<h3>subeader4</h3>
Subcontent
</html>

is a flat file. Every node is on the same level: children of html
node.
What I need is to divide this into deeper structure:

<newsletter>
<title>title</title>
<section header="header1">
Content
<subsection header="subheader1">
Subcontent
</subsection>
<subsection header="subheader2">
Subcontent
</subsection>
</section>
<section header="header1">
Content
<subsection header="subheader1">
Subcontent
</subsection>
<subsection header="subheader2">
Subcontent
</subsection>
</section>
</newsletter>

I don't know is it possible or how to select each node between </h2>
of the current node and <h2> of the next section header.

<html>
<h1>title</h1>
<h2>header1</h2>
---->Content // This becomes the CHILDREN of <section>
created
----><h3>subeader1</h3> // from <h2> above.
---->Subcontent // How to select this as XPath Query?
----><h3>subeader2</h3> // The same will be done with <h3> tags,
but
---->Subcontent // they become <subsection> nodes
<h2>header2</h2>
Content
<h3>subeader3</h3>
Subcontent
<h3>subeader4</h3>
Subcontent
</html>

Any help appreciated!
Jul 20 '05 #1
0 1027

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

Similar topics

5
by: Alex Vinokur | last post by:
Functor-parameters in the for_each() and transform() algorithms are passed by value. Might it make sense to have also algorithms for_each2() and transform2() which pass Functor-parameters by...
0
by: Xiaolei Li | last post by:
first off, i'm a total newbie at this stuff so excuse any wrong usage of terminology or whatever else. i have a XSL to transform a Document such that all "text" nodes will have a "SPAN" inserted...
2
by: John Lehmann | last post by:
I have an interesting problem. I am performing an XSL transform using the System.Xml.Xsl.Transform class. I have a database that contains the XSL style sheet string. And it seems to work pretty...
9
by: Patrick Guio | last post by:
Dear all, I am trying to use the std::transform algorithm to to the following vector< vector<char> >::iterator ik = keys.begin(); // key list iterator vector< vector<char> >::iterator is = ik;...
6
by: Stephen Cook | last post by:
Having worked through the problems around enabling the document function using an XmlUrlResolver I started work on building a useful class to hide the intricacies. Trying to generalise the process...
3
by: Jason S | last post by:
Hello Group, I am just about tearing my hair out with this one and thought someone may have some insight. I have a transform that wasn't working so I grabbed the nearest debugger (xselerator)...
4
by: schneider | last post by:
Anyone know if there is a way to dynamicly create a Xslt template/s and use them as an xml transform with-out use files for the Xslt? All the methods I see use files. I want to create a Xslt...
1
by: Mike Hofer | last post by:
I've got two statements in my code that are both generating weird, weird, weird messages: The first one was, Dim document As System.Xml.XmlDocument Dim navigator As...
4
by: Dean Card | last post by:
Okay, so here is the situation. I have need to do some on-the-fly image creation. I have everything working great except for the last part of it, applying a perspective type transform to the...
6
by: Vijai Kalyan | last post by:
Hello, I am trying to use std::transform to take in a collection of strings, transform them and insert the result into an output container. So, I wrote something like this: std::wstring...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.