Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

XSLT genius required

 
   Web Hosting and Web Master Forums (Home) -> Webmaster RSS
Next:  Please help  
Author Message
nothespacegirl

External


Since: Aug 11, 2004
Posts: 607



(Msg. 1) Posted: Mon Sep 27, 2004 1:36 pm
Post subject: XSLT genius required
Archived from groups: alt>www>webmaster (more info?)

Morning all...

Okay I've been struggling with XSLT all weekend and I'm getting
nowhere... nobody here knows how to use it (the only guy is off on
holiday, and his handover consisted of letting me to look it up on
google :/). I'm totally stuck.

http://www.dhnewmedia.com/temp/xsl/source.htm
http://www.dhnewmedia.com/temp/xsl/test.xsl

I'm totally stuck... I've started to get the basics, but this is just
too complex! Anyone here offer some suggestions, or at least give me a
push in the right direction? I've stripped down a source file containing
our somewhat munged content (I had to strip out our clients' branding)
but the file renders okay and should be solid XHTML. I cant even get
THAT to work... :/

HELP!


--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #

 >> Stay informed about: XSLT genius required 
Back to top
Login to vote
discooctopusn0

External


Since: Nov 12, 2003
Posts: 107



(Msg. 2) Posted: Tue Sep 28, 2004 12:02 am
Post subject: Re: XSLT genius required [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

SpaceGirl typed:
 > Morning all...
 >
 > Okay I've been struggling with XSLT all weekend and I'm getting
 > nowhere... nobody here knows how to use it (the only guy is off on
 > holiday, and his handover consisted of letting me to look it up on
 > google :/). I'm totally stuck.
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://www.dhnewmedia.com/temp/xsl/source.htm</font" target="_blank">http://www.dhnewmedia.com/temp/xsl/source.htm</font</a>>
<font color=purple> > <a style='text-decoration: underline;' href="http://www.dhnewmedia.com/temp/xsl/test.xsl</font" target="_blank">http://www.dhnewmedia.com/temp/xsl/test.xsl</font</a>>
 >
 > I'm totally stuck... I've started to get the basics, but this is just
 > too complex! Anyone here offer some suggestions, or at least give me a
 > push in the right direction? I've stripped down a source file
 > containing our somewhat munged content (I had to strip out our
 > clients' branding) but the file renders okay and should be solid
 > XHTML. I cant even get THAT to work... :/
 >
 > HELP!

Can you send me (just to be sure) the XML file (I take it that the
source.html file is your source XML?), the XSLT file, and some
description on the desired results. I will give it a browse if you
like.

just one small tip... In my experience these XML files *must* be true to
their dtd. ... make sure the XML file validates before transforming.<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: XSLT genius required 
Back to top
Login to vote
usewebsiteinsi1

External


Since: Aug 30, 2004
Posts: 71



(Msg. 3) Posted: Tue Sep 28, 2004 12:02 am
Post subject: Re: XSLT genius required [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

*Disco Octopus* wrote in alt.www.webmaster:
 > Can you send me (just to be sure) the XML file (I take it that the
 > source.html file is your source XML?), the XSLT file, and some
 > description on the desired results. I will give it a browse if you
 > like.

<AOL>

Sorry, only just seen this now - I've just got out of bed :/
--
Andrew Urquhart
- Contact me: <a style='text-decoration: underline;' href="http://andrewu.co.uk/contact/" target="_blank">http://andrewu.co.uk/contact/</a><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: XSLT genius required 
Back to top
Login to vote
nothespacegirl

External


Since: Aug 11, 2004
Posts: 607



(Msg. 4) Posted: Tue Sep 28, 2004 12:02 am
Post subject: Re: XSLT genius required [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Andrew Urquhart wrote:
 > *Disco Octopus* wrote in alt.www.webmaster:
 >
  >>Can you send me (just to be sure) the XML file (I take it that the
  >>source.html file is your source XML?), the XSLT file, and some
  >>description on the desired results. I will give it a browse if you
  >>like.
 >
 >
 > <AOL>
 >
 > Sorry, only just seen this now - I've just got out of bed :/

The copy online now fully validates (as xhtml/trans)

(http://www.dhnewmedia.com/temp/xsl/source.htm)

I can email it if it's easier!


--


x theSpaceGirl (miranda)

# lead designer @ <a style='text-decoration: underline;' href="http://www.dhnewmedia.com" target="_blank">http://www.dhnewmedia.com</a> #
# remove NO SPAM to email, or use form on website #<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: XSLT genius required 
Back to top
Login to vote
usewebsiteinsi1

External


Since: Aug 30, 2004
Posts: 71



(Msg. 5) Posted: Tue Sep 28, 2004 12:02 am
Post subject: Re: XSLT genius required [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

*SpaceGirl* wrote in alt.www.webmaster:
 > Andrew Urquhart wrote:
  >> *Disco Octopus* wrote in alt.www.webmaster:
  >>
   >>>Can you send me (just to be sure) the XML file (I take it that the
   >>>source.html file is your source XML?), the XSLT file, and some
   >>>description on the desired results. I will give it a browse if you
   >>>like.
  >>
  >> <AOL>
  >>
  >> Sorry, only just seen this now - I've just got out of bed :/
 >
 > The copy online now fully validates (as xhtml/trans)
 >
 > (http://www.dhnewmedia.com/temp/xsl/source.htm)
 >
 > I can email it if it's easier!

Not actually transformed an XHTML file before, but with the namespace
added to the root element of your source document
(<html xmlns="http://www.w3.org/1999/xhtml">) then the following
transforms it into a CSV output under MSXML:


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:html="http://www.w3.org/1999/xhtml" exclude-result-prefixes="html">
<xsl:output method="text" omit-xml-declaration="yes" encoding="windows-1252"/>

<xsl:template match="/">
<xsl:apply-templates select="//html:table[@class='data']/html:thead/html:tr | //html:table[@class='data']/html:tbody/html:tr"/>
</xsl:template>

<xsl:template match="html:tr">
<xsl:apply-templates select="html:td | html:th"/>
</xsl:template>

<xsl:template match="html:th | html:td">
<xsl:text>"</xsl:text>
<xsl:value-of select="normalize-space(html:a/text() | text())"/>
<xsl:text>"</xsl:text>
<xsl:choose>
<xsl:when test="position() = last()">
<xsl:text> </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>,</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>


--
Andrew Urquhart
- FAQ: <a style='text-decoration: underline;' href="http://www.aww-faq.org/" target="_blank">http://www.aww-faq.org/</a>
- Archive: <a style='text-decoration: underline;' href="http://groups.google.com/groups?group=alt.www.webmaster" target="_blank">http://groups.google.com/groups?group=alt.www.webmaster</a>
- Contact me: <a style='text-decoration: underline;' href="http://andrewu.co.uk/contact/" target="_blank">http://andrewu.co.uk/contact/</a><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: XSLT genius required 
Back to top
Login to vote
nothespacegirl

External


Since: Aug 11, 2004
Posts: 607



(Msg. 6) Posted: Tue Sep 28, 2004 12:02 am
Post subject: Re: XSLT genius required [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Andrew Urquhart wrote:
 > *SpaceGirl* wrote in alt.www.webmaster:
 >
  >>Andrew Urquhart wrote:
  >>
   >>>*Disco Octopus* wrote in alt.www.webmaster:
   >>>
   >>>
   >>>>Can you send me (just to be sure) the XML file (I take it that the
   >>>>source.html file is your source XML?), the XSLT file, and some
   >>>>description on the desired results. I will give it a browse if you
   >>>>like.
   >>>
   >>><AOL>
   >>>
   >>>Sorry, only just seen this now - I've just got out of bed :/
  >>
  >>The copy online now fully validates (as xhtml/trans)
  >>
  >>(http://www.dhnewmedia.com/temp/xsl/source.htm)
  >>
  >>I can email it if it's easier!
 >
 >
 > Not actually transformed an XHTML file before, but with the namespace
 > added to the root element of your source document
 > (<html xmlns="http://www.w3.org/1999/xhtml">) then the following
 > transforms it into a CSV output under MSXML:
 >
 >
 > <?xml version="1.0" encoding="UTF-8"?>
 > <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:html="http://www.w3.org/1999/xhtml" exclude-result-prefixes="html">
 > <xsl:output method="text" omit-xml-declaration="yes" encoding="windows-1252"/>
 >
 > <xsl:template match="/">
 > <xsl:apply-templates select="//html:table[@class='data']/html:thead/html:tr | //html:table[@class='data']/html:tbody/html:tr"/>
 > </xsl:template>
 >
 > <xsl:template match="html:tr">
 > <xsl:apply-templates select="html:td | html:th"/>
 > </xsl:template>
 >
 > <xsl:template match="html:th | html:td">
 > <xsl:text>"</xsl:text>
 > <xsl:value-of select="normalize-space(html:a/text() | text())"/>
 > <xsl:text>"</xsl:text>
 > <xsl:choose>
 > <xsl:when test="position() = last()">
 > <xsl:text> </xsl:text>
 > </xsl:when>
 > <xsl:otherwise>
 > <xsl:text>,</xsl:text>
 > </xsl:otherwise>
 > </xsl:choose>
 > </xsl:template>
 > </xsl:stylesheet>
 >
 >

That works like a dream! And, I pretty much understand your code too...
yay Smile Thank you so much for the help! Now I just have to get the "real"
page to generate nicely structured XHTML... I had to do a lot of hand
correction of that data I put up for testing. I hate messing with other
peoples' JSP :/

--


x theSpaceGirl (miranda)

# lead designer @ <a style='text-decoration: underline;' href="http://www.dhnewmedia.com" target="_blank">http://www.dhnewmedia.com</a> #
# remove NO SPAM to email, or use form on website #<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: XSLT genius required 
Back to top
Login to vote
discooctopusn0

External


Since: Nov 12, 2003
Posts: 107



(Msg. 7) Posted: Tue Sep 28, 2004 12:47 am
Post subject: Re: XSLT genius required [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

SpaceGirl wrote:
 > Andrew Urquhart wrote:
  >> *Disco Octopus* wrote in alt.www.webmaster:
  >>
   >>> Can you send me (just to be sure) the XML file (I take it that the
   >>> source.html file is your source XML?), the XSLT file, and some
   >>> description on the desired results. I will give it a browse if you
   >>> like.
  >>
  >>
  >> <AOL>
  >>
  >> Sorry, only just seen this now - I've just got out of bed :/
 >
 > The copy online now fully validates (as xhtml/trans)
 >
 > (http://www.dhnewmedia.com/temp/xsl/source.htm)
 >
 > I can email it if it's easier!

Did you get it working? Are you still stuck on it?<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: XSLT genius required 
Back to top
Login to vote
usewebsiteinsi1

External


Since: Aug 30, 2004
Posts: 71



(Msg. 8) Posted: Tue Sep 28, 2004 1:52 am
Post subject: Re: XSLT genius required [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

*Disco Octopus* wrote in alt.www.webmaster:
 > Did you get it working? Are you still stuck on it?

<a style='text-decoration: underline;' href="http://groups.google.com/groups?selm=ytj5q8isfyh7%24.dlg%40usenet.andrewu.co.uk" target="_blank">http://groups.google.com/groups?selm=ytj5q8isfyh7%24.dlg%40usenet.andrewu.co.uk</a>
--
Andrew Urquhart
- Contact me: <a style='text-decoration: underline;' href="http://andrewu.co.uk/contact/" target="_blank">http://andrewu.co.uk/contact/</a><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: XSLT genius required 
Back to top
Login to vote
nothespacegirl

External


Since: Aug 11, 2004
Posts: 607



(Msg. 9) Posted: Wed Sep 29, 2004 2:01 pm
Post subject: Re: XSLT genius required [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Andrew Urquhart wrote:
 > *Disco Octopus* wrote in alt.www.webmaster:
 >
  >>Did you get it working? Are you still stuck on it?
 >
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://groups.google.com/groups?selm=ytj5q8isfyh7%24.dlg%40usenet.andrewu.co.uk</font" target="_blank">http://groups.google.com/groups?selm=ytj5q8isfyh7%24.dlg%40usenet.andr....co.uk&</a>>

This isn't quite working :/

It appears that the rows aren't getting broken up correctly.

If I grab the source HTML from the results webpage and paste it into
XMLSpy and run the XSTL the results seem to generate fine. If I then
copy that into a CSV file and have Excel load it, it complains that the
data is incomplete, and dumps the output onto a single row.

When I actually let the XSLT run on our application I get a zero-length
output, but no errors are logged by Tomcat.

I have no idea why it wont run. Our application used to generate the
output fine, but since we applied a new front end it stopped - however I
cant tell if the fault is something new in the app, or the XSLT isn't
working right... we've got a customer breathing down our neck and
running around in circles here.


--


x theSpaceGirl (miranda)

# lead designer @ <a style='text-decoration: underline;' href="http://www.dhnewmedia.com" target="_blank">http://www.dhnewmedia.com</a> #
# remove NO SPAM to email, or use form on website #<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: XSLT genius required 
Back to top
Login to vote
usewebsiteinsi1

External


Since: Aug 30, 2004
Posts: 71



(Msg. 10) Posted: Wed Sep 29, 2004 2:01 pm
Post subject: Re: XSLT genius required [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

*SpaceGirl* wrote in alt.www.webmaster:
 > Andrew Urquhart wrote:
<font color=green>  >> <a style='text-decoration: underline;' href="http://groups.google.com/groups?selm=ytj5q8isfyh7%24.dlg%40usenet.andrewu.co.uk</font" target="_blank">http://groups.google.com/groups?selm=ytj5q8isfyh7%24.dlg%40usenet.andr....co.uk&</a>>
 >
 > This isn't quite working :/

Does for me :/

 > It appears that the rows aren't getting broken up correctly.

Rows are currently being terminated with \r\n so they should be

 > If I grab the source HTML from the results webpage and paste it into
 > XMLSpy and run the XSTL the results seem to generate fine.

Same here (assuming you've added xmlns="http://www.w3.org/1999/xhtml" to
the html element)

 > If I then copy that into a CSV file and have Excel load it, it
 > complains that the data is incomplete, and dumps the output onto a
 > single row.

I don't have Excel, only OpenOffice.org. If I copy the result into
Textpad and save it as CSV, OOo opens it just fine - it auto-detects the
rows and columns automatically with no user intervention. If someone
with Excel wants to check if Excel barfs on it here's the CSV file I
just saved from the transformation:
<a style='text-decoration: underline;' href="http://andrewu.co.uk/temp/spacegirl/data.csv" target="_blank">http://andrewu.co.uk/temp/spacegirl/data.csv</a>

 > When I actually let the XSLT run on our application I get a
 > zero-length output, but no errors are logged by Tomcat. I have no
 > idea why it wont run.

You're likely using Saxon or another XSLT processor on a Java-based
system rather than MSXML! Different processors do different things
unfortunately, especially with bugs.

 > Our application used to generate the output fine, but since we applied
 > a new front end it stopped - however I cant tell if the fault is
 > something new in the app, or the XSLT isn't working right... we've
 > got a customer breathing down our neck and running around in circles
 > here.

I don't get paid enough! Bah, OK, I'll try and install Saxon and test it
that way...
--
Andrew Urquhart
- FAQ: <a style='text-decoration: underline;' href="http://www.aww-faq.org/" target="_blank">http://www.aww-faq.org/</a>
- Archive: <a style='text-decoration: underline;' href="http://groups.google.com/groups?group=alt.www.webmaster" target="_blank">http://groups.google.com/groups?group=alt.www.webmaster</a>
- Contact me: <a style='text-decoration: underline;' href="http://andrewu.co.uk/contact/" target="_blank">http://andrewu.co.uk/contact/</a><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: XSLT genius required 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
morning all... welcome to XSLT hell... - .... :/ -- x theSpaceGirl (miranda) # lead designer @ http://www.dhnewmedia.com # # remove NO SPAM to email, or use form on website #

CSS Help required - All, I am working on a new page layout utilising CSS positioning to achieve a horizontal banner/nav bar. I have a layout I am happy with when displayed in IE (5.5 and 6) but it looks rubbish in Netscape 7.x. Can you guys have a look and point me in the...

NT4 host required - Help! I need to do some remote testing using an NT4 host. Does anyone know of a hosting company that offers NT4 hosting? Ideally I just need a month at most, with FTP access. Thanks Rae MacLeman

Freelance Web Designer required - NW UK position Due to an increasing workload we are looking for an able web designer, capable of producing dynamic web sites for publication on Microsoft based servers. A knowledge of Access and SQLserver technologies as well as a good design ability is...

IIS problem - authorization required - Hi all, I'm new here. I'm having problems with my IIS. I've got Windows XP with IIS installed and I can view my local web sites with IE just fine. However, when I try to view them with an alternative browser such as Mozilla or Opera, authorization is..
   Web Hosting and Web Master Forums (Home) -> Webmaster All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]