User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » XSLT Page [1]  
Spontaneous
All American
27372 Posts
user info
edit post

I'm trying to export a Calc spreadsheet into an XML format.

The XML document should look like this:


<markers>
<marker(1) attribute1="{column1 row1 of spreadsheet}" attribute 2="{column2 row1 of spreadsheet}" ... />
<marker(2) attribute1="{column1 row2 of spreadsheet}" attribute 2="{column2 row2 of spreadsheet}" ... />
<marker(x) attribute1="{column1 rowx of spreadsheet}" attribute 2="{column2 rowx of spreadsheet}" ... />
</markers>


My style sheet did not work.


<?xml version="1.0" encoding="UTF-8"?>
<!-- We must define several namespaces, because we need them to access -->
<!-- the document model of the in-memory OpenOffice.org document. -->
<!-- If we want to access more parts of the document model, we must -->
<!-- add there namesspaces here, too. -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
exclude-result-prefixes="office table text">

<xsl:output method = "xml" indent = "yes" encoding = "UTF-8" omit-xml-declaration = "no"/>


<!-- Process the document model -->
<xsl:template match="/">
<markers>
<xsl:apply-templates select="//table:table"/>
</markers>
</xsl:template>

<xsl:template match="table:table">
<!-- Process all table-rows after the column labels in table-row 1 -->
<xsl:for-each select="table:table-row">
<marker>
<xsl:for-each select="table:table-cell">
<xsl:choose>
<xsl:when test="position()=1">
<xsl:attribute name="year" />
</xsl:when>
<xsl:when test="position()=2">
<xsl:attribute name="team" />
</xsl:when>
<xsl:when test="position()=3">
<xsl:attribute name="city" />
</xsl:when>
<xsl:when test="position()=4">
<xsl:attribute name="state" />
</xsl:when>
<xsl:when test="position()=5">
<xsl:attribute name="lat" />
</xsl:when>
<xsl:when test="position()=6">
<xsl:attribute name="lng" />
</xsl:when>
<xsl:when test="position()=7">
<xsl:attribute name="type" />
</xsl:when>
</xsl:choose>
</xsl:for-each>
</marker>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>


I'll check the OO Forums as well.

9/21/2009 12:34:01 PM

qntmfred
retired
40726 Posts
user info
edit post

KILL IT WITH FIRE!

9/21/2009 2:55:00 PM

Spontaneous
All American
27372 Posts
user info
edit post

GG, Ken!

I'm researching OO Basic Macros now.

9/21/2009 3:05:27 PM

Ernie
All American
45943 Posts
user info
edit post

Quote :
"I'm researching OO Basic Macros now."


Realize that I'm not just trying to be a pessimist in all your threads

But why the fuck would you ever want to do that

[Edited on September 21, 2009 at 4:02 PM. Reason : !]

9/21/2009 4:02:15 PM

Spontaneous
All American
27372 Posts
user info
edit post

I'm getting mixed messages or no messages from the forums I'm perusing. One guy told me that XSLT was outdated and some sites were all like try macros.

I know you're not just trying to be a pessimist. You're just ridiculously intelligent and it's funny to watch "dumb" people trip over themselves.

9/21/2009 7:17:58 PM

Ernie
All American
45943 Posts
user info
edit post

I'm not smart at all

I just don't see why anyone would take the time to learn OO Basic Macros

I know you're expanding your skill set and all (which is awesome, really) but that's gotta be about the least useful skill in the history of skills.

9/21/2009 7:27:31 PM

Stein
All American
19842 Posts
user info
edit post

Quote :
"I'm getting mixed messages or no messages from the forums I'm perusing. One guy told me that XSLT was outdated and some sites were all like try macros."


I don't really know if XSLT is outdated, but holy shit do I remember it being a complete and utter pain in the ass.

9/21/2009 9:10:01 PM

 Message Boards » Tech Talk » XSLT Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.