Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 19th, 2007, 11:19 AM
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default help with xslt transformation

Hi. everyone
I am new to xslt and Xforms technologies. I am trying to write a very simple xslt stylesheet to transform a very simple xml doc into Xforms doc. (Hello world example)
here are my xml doc and xslt stylesheet could plz tell me what wrong
with my stylesheet. Remark: X-smiles is used as web browser.
the page is called as: http://localhost:8080/mydoc.xml
both xml do and xslt stylesheet in the same directory

many thanks in advance
<?xml version='1.0'?>
<?xml-stylesheet type="text/xsl" stylesheet01.xslt"?>
 <data>
   <Name> Hello World </Name>
 </data>

and here is XSLT
<?xml version='1.0'?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events"
 xmlns:xforms="http://www.w3.org/2002/xforms/cr" xmlns:xmml="http://www.xmml.com" >
<xsl:output method="xhtml" indent="yes"
 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />


<xsl:template match="/">

<html>
<head>
    <title>Title comes here </title>
     <xforms:model >
        <xforms:submission action="" method="post" id="s"/>

        <xforms:instance>
          <xsl:apply-templates select="data" />
         </xforms:instance>
          </xforms:model >
</head>
<body>
  <p> Hi.
  <xforms:output ref="data/name"/>
  </p>
</body>
</html>
</xsl:template>

<xsl:template match="data/name">
  <xsl:copy>
    <xsl:copy-of select="data/name"/>
  </xsl:copy>
  </xsl:template>
  </xsl:stylesheet>
Reply With Quote
  #2 (permalink)  
Old November 19th, 2007, 11:43 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well one thing is that your processing instruction
Code:
<?xml-stylesheet type="text/xsl" stylesheet01.xslt"?>
should be
Code:
<?xml-stylesheet type="text/xsl" href="stylesheet01.xslt"?>
but you haven't said what the error or problem is, what's happening and how does this differ from what you are expecting?

(Does x-smiles support XSLT version 2.0?)

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #3 (permalink)  
Old November 19th, 2007, 12:03 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Your stylesheet runs OK and produces output. So what makes you think there is anything wrong with it? (Give us a clue, we are human)

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #4 (permalink)  
Old November 19th, 2007, 12:47 PM
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

this is waht X-smiles display:
http://localhost:8080/mydoc.xml
nulljava.net.MalformedURLException
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at fi.hut.tml.xsmiles.XSmilesXMLDocument.findXSL(XSmi lesXMLDocument.java:426)
    at fi.hut.tml.xsmiles.XSmilesXMLDocument.transformDoc ument(XSmilesXMLDocument.java:175)
    at fi.hut.tml.xsmiles.XSmilesXMLDocument.retrieveDocu ment(XSmilesXMLDocument.java:163)
    at fi.hut.tml.xsmiles.content.xml.XMLContentHandler.f etchParseAndTransformDocument(XMLContentHandler.ja va:171)
    at fi.hut.tml.xsmiles.content.xml.XMLContentHandler.f etch(XMLContentHandler.java:116)
    at fi.hut.tml.xsmiles.content.xml.XMLContentHandler.p refetch(XMLContentHandler.java:46)
    at fi.hut.tml.xsmiles.content.xml.XMLContentHandler.p lay(XMLContentHandler.java:60)
    at fi.hut.tml.xsmiles.Browser$HandlerThread.run(Brows er.java:765)
    at java.lang.Thread.run(Unknown Source)

Reply With Quote
  #5 (permalink)  
Old November 19th, 2007, 01:26 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Presumably xsmiles is objecting to

<xforms:submission action="" method="post" id="s"></xforms:submission>

Since action="" is precisely what your stylesheet asks to be output, I don't quite see how you classify this as an XSLT problem?

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #6 (permalink)  
Old November 19th, 2007, 01:45 PM
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi. even if we eliminate the
  <xforms:submission action="" method="post" id="s"></xforms:submission>
we still get the same problem.
any other clue?
plz help
cheers


Reply With Quote
  #7 (permalink)  
Old November 19th, 2007, 01:51 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If the output of your transformation isn't valid XForms, and you don't understand why, then you need to ask on an XForms forum. The fact that your XForms document was generated using XSLT is completely irrelevant to your problem.

Before starting to write a program in XSLT or any other language, it's always a good idea to know what output you want it to produce. We can't really help you with that.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help on xslt transformation li72 XSLT 2 March 4th, 2008 10:14 AM
Help on XSLT transformation li72 XSLT 2 February 22nd, 2008 12:33 PM
XSLT transformation using JDK 1.5.0 kgoldvas XSLT 4 October 30th, 2007 02:06 PM
XSLT transformation yengzhai XSLT 1 April 21st, 2005 05:51 AM
XSLT transformation causes ^M reddygaru XSLT 2 December 16th, 2003 10:41 AM



All times are GMT -4. The time now is 03:46 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.