473,586 Members | 2,792 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xml:aid table to HTML

I'm a bit stumped about this request on an Adobe forum. Apparently, exporting a
table from their flagship InDesign to XML produces the following output for a
table (only first 2 rows listed; after that it's more of the same):

<?xml version="1.0" encoding="UTF-8"?>
< Table xmlns:aid="http ://ns.adobe.com/AdobeInDesign/4.0/" aid:table="tabl e"
aid:trows="7" aid:tcols="3">
<Cell aid:table="cell " aid:crows="1" aid:ccols="2">
<CellHeading>Si tuacao do Beneficiario</CellHeading>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 98.934380799140 81">
<CellHeading>Ta xas de Bonificacao</CellHeading>
</Cell>

Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 78.091861114101 46">
<CellBodyCenter >
<CharBold>Idade </CharBold>
</CellBodyCenter>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 78.091861114101 46">
<CellBodyCenter >
<CharBold>Carre ira Contributiva (em anos)</CharBold>
</CellBodyCenter>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 98.934380799140 81">
<CellBodyCenter >
<CharBold>Mensa l</CharBold>
</CellBodyCenter>
</Cell>

-- and the request of the OP is, how to convert this to HTML. Sounds easy? Not 4
me. The first row features a colspan (aid:ccols="2") ; without this, I could --
and would -- cheat, but this colspan messes up the <Cellcount. You see the
problem. Thou Shalt Not Loop or Count in XSLT As There Are No Variables! Anyone
else see a solution?

[Jongware]
Jul 9 '07 #1
4 3177
[Jongware] wrote:
Thou Shalt Not Loop or Count in XSLT As There Are No Variables!
General observation: you can often use position(), or last() applied to
an expression that counts the preceeding instances, as a replacement for
a loop counter. Try those first -- preferably position(), since it will
be more efficient.

See examples in the XSLT FAQ. Research left as an exercise for the student.
(If all else fails, it is possible to use recursion in place of looping
-- but that really should be a last resort.)
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jul 9 '07 #2
"Joe Kesselman" <ke************ @comcast.netwro te in message
news:RJ******** *************** *******@comcast .com...
General observation: you can often use position(), or last() applied to an
expression that counts the preceeding instances, as a replacement for a
loop counter. Try those first -- preferably position(), since it will be
more efficient.
That would have been my cheat if all to-be rows had the same number of
cells. A short synopsis of the (quite unreadable) XML:
(header)
<table col='3' row='5'>
(first row)
<cell span='2'><cell span='1'>
(the rest)
<cell span='1'><cell span='1'<cell span='1'>

-- which has to be output in HTML form, grouping cells per row. The first
row only has 2 cells, as their 'spans' added equals the number of columns,
while the other rows have 3 cells each.
(If all else fails, it is possible to use recursion in place of looping --
but that really should be a last resort.)
The last resort is (always) cheating, and write a custom XSL for this case.
And another one for different numbers of rows and columns. And yet another
if the spans are in other places...
I tried recursion (sort of), propagating a 'current column' semi-variable
through the Cell template, but that was a very bad idea (as in I couldn't
insert row starts and ends).

[Jw]
Jul 10 '07 #3
"Pavel Lepin" <p.*****@ctncor p.comwrote in message
news:f6******** **@aioe.org...
>
[Jongware] <Id***********@ hotmail.comwrot e in
<4Pwki.3912$%q4 .1386@amstwist0 0>:
>I'm a bit stumped about this request on an Adobe forum.

Perhaps you should've sent the OP here instead of serving as
a middleman.
I'll mention this ng ;-)
Engaging my gray matter yielded the following in about ten
minutes:
[brilliant, working solution snipped]

Oof. Just 10 mins?? It'll take me a bit longer than that to understand it.
Dealing with rowspans is left as an exercise for the reader.
Sending polite hate-mail to Adobe asking them to remove
their neck-mounted brain casings from their own rear-end
orifices is advised as well.
Fully agree with that.

[Jw]
Jul 10 '07 #4
Thank you Jongware, and
Pavel Lepin!

This is a great solution but now I get an XML with some tables and the
tables has rowspan and colspan too. Can you help me for the transform?
Or the method like as the previous method?

<Table xmlns:aid="http ://ns.adobe.com/AdobeInDesign/4.0/"
aid:table="tabl e" aid:trows="7" aid:tcols="3">
<Cell aid:table="cell " aid:crows="1" aid:ccols="3">
<CellHeading>Si tuação do Beneficiário/Taxas de Bonificação</
CellHeading>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 78.091861114101 46">
<CellBodyCenter >
<CharBold>Idade </CharBold>
</CellBodyCenter>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 103.98750365826 466">
<CellBodyCenter >
<CharBold>Carre ira Contributiva (em anos)</CharBold>
</CellBodyCenter>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 72.788738254977 62">
<CellBodyCenter >
<CharBold>Mensa l</CharBold>
</CellBodyCenter>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 78.091861114101 46">
<CellBodyCenter >&lt; 65</CellBodyCenter>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 103.98750365826 466">
<CellBodyCenter >Condições de Acesso à Pensão sem
Penalização</CellBodyCenter>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 72.788738254977 62">
<CellBodyCenter >0,65%</CellBodyCenter>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 78.091861114101 46"></Cell>
<Cell aid:table="cell " aid:crows="3" aid:ccols="1"
aid:ccolwidth=" 103.98750365826 466">
<CellBodyCenter >15 a 24 </CellBodyCenter>
<CellBodyCenter >25 a 34 </CellBodyCenter>
<CellBodyCenter >35 a 39</CellBodyCenter>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 72.788738254977 62">
<CellBodyCenter >0.33%</CellBodyCenter>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 78.091861114101 46">
<CellBodyCenter >&gt; 65</CellBodyCenter>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 72.788738254977 62">
<CellBodyCenter >0.65%</CellBodyCenter>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 78.091861114101 46"></Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 72.788738254977 62">
<CellBodyCenter >1.0%</CellBodyCenter>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 78.091861114101 46">
<CellBodyCenter >&gt; 65</CellBodyCenter>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 103.98750365826 466">
<CellBodyCenter >&gt; 40</CellBodyCenter>
</Cell>
<Cell aid:table="cell " aid:crows="1" aid:ccols="1"
aid:ccolwidth=" 72.788738254977 62">
<CellBodyCenter >0.5%</CellBodyCenter>
</Cell>
</Table>

Thank you!

Jul 17 '07 #5

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

Similar topics

7
1652
by: marboti | last post by:
http://www.testyourabilities.com/it/ IT tests. C, C++, XML, HTML, .NET, SQL...
0
983
by: marboti | last post by:
http://www.testyourabilities.com/it/ IT tests. SQL, XML, HTML, .NET, C++...
1
1279
by: marboti | last post by:
http://www.testyourabilities.com/it/ IT tests. C#, ASP.NET, VB.NET, SQL, XML, HTML, C, C++...
0
901
by: marboti | last post by:
http://www.testyourabilities.com/it/ IT tests. ASP.NET, C#, VB.NET, SQL, XML, HTML, C, C++...
0
794
by: marboti | last post by:
http://www.testyourabilities.com/it/ IT tests. VB.NET, C#, ASP.NET, SQL, XML, HTML, C, C++...
3
5668
by: Dale Strickland-Clark | last post by:
A colleague has asked me this and I don't know the answer. Can anyone here help with this? Thanks in advance. Here is his email: I am trying to parse an HTML document using the xml.dom.minidom parser and then outputting a valid HTML document, all using the ISO-8859-1 charset. For example: My input:
0
945
by: Yama | last post by:
Hi, This code does not work in IE 6.0: <html> <body> <!-- <?xml version="1.0" encoding="ISO-8859-1"?> <CATALOG>
1
1576
by: abhishekbrave | last post by:
I hava xml code in following format. My aim is to convert this show the data present here in tabular format to a HTML page. <table bid="18" sid="7" ref="REF_17" x="0" y="80" h="50" w="607" nbrow="1" nbcol="1" class="section"> - <tr y="0" h="50"> - <td> - <bag h="50" w="607" layout="bag"> - <bag bid="18" sid="7" ref="REF_18" x="0" y="0"...
2
2621
by: anand18101984 | last post by:
I have an XML file with a table in the below format, <TABLE> <TR> <TH>EVENT</TH> <TH>SUMMARY</TH> </TR> <TR> <TD>US approval of Xience V</TD> <TD>Xience V is the first drug-eluting stent to demonstrate superiority over another DES in the primary...
0
7836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8336
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...
1
7950
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...
0
6606
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...
0
5389
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...
0
3835
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...
0
3863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2343
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1175
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...

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.