Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 28th, 2008, 08:13 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

You still need to wrap the <xsl:for-each> instruction in a <xsl:template match="/"> declaration.

/- Sam Judson : Wrox Technical Editor -/
 
Old January 28th, 2008, 08:29 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

It's a very peculiar error message, because I can't see any reason why the processor would imagine that "." is intended to be the name of a variable. But this solution using tokenize() requires XSLT 2.0, and you seem to be trying to run it under Xalan, which only supports XSLT 1.0. So you need to fix that.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old January 28th, 2008, 08:59 AM
Authorized User
 
Join Date: Jan 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Sam,

It would be appriciated if you could modify the code and send it to me because am not understanding what exactly u r saying

Please help me on this, Thanks in adavance

 
Old January 28th, 2008, 09:01 AM
Authorized User
 
Join Date: Jan 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Sam,

It would be Appriciated if you could modify the code and send it to me because am not understanding what exactly u r saying

Please help me on this, Thanks in advance

 
Old January 28th, 2008, 09:11 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Code:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
  <xsl:output method="xml" />

 <xsl:template match="/">

      <xsl:for-each select="tokenize(datastream/payload/text(), '#10;')">
    <Record>
        <BUSINESS_UNIT><xsl:value-of select="substring(.,1, 5)"/></BUSINESS_UNIT>
        <EMPLID><xsl:value-of select="substring(.,6, 11)"/></EMPLID>
        <ASOFDATE><xsl:value-of select="substring(.,17, 10)"/></ASOFDATE>

 ... etc

</Record>
     <xsl:value-of select="position()"/>
</xsl:for-each>
 
</xsl:template>    

  </xsl:stylesheet>


As Michael says, you will need to be using Saxon for this to work, as Xalon does not support XSLT 2.0 (and tokenize() is a XSLT 2.0 function).


/- Sam Judson : Wrox Technical Editor -/
 
Old January 28th, 2008, 12:00 PM
Authorized User
 
Join Date: Jan 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Sam and Michal,

Thanks a lot for all your support, it's working fine

could please advise me , i would like to skip the first record of the file

what should i do if i want to skip the first record of the file





 
Old January 28th, 2008, 12:05 PM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

You can do a test based on position(), e.g.

<xsl:if test="position() > 1">
</xsl:if>

/- Sam Judson : Wrox Technical Editor -/
 
Old January 29th, 2008, 03:12 AM
Authorized User
 
Join Date: Jan 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks a lot for this also,

one more doubt : is the Latest Xalan parser is supporting the XSLT 2.0



 
Old January 29th, 2008, 05:09 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

No, there is no version of Xalan that supports XSLT 2.0. There are currently three XSLT 2.0 processors available: Saxon, AltovaXML, and Gestalt.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old January 29th, 2008, 09:51 AM
Authorized User
 
Join Date: Jan 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Sam or Michael,

is there any other way we can do the XSLT transformation with out tokenize, because our client is having the Internal adapter that is referring the xalan parser

so this code is not working when we used the xalan, because as Michael said xalan parser doesn’t support the XSLT2.0







Similar Threads
Thread Thread Starter Forum Replies Last Post
Root Cause:java.lang.NoSuchMethodError: java.util. anees81 JSP Basics 3 March 1st, 2011 08:55 AM
java.lang.OutOfMemoryError: Java heap space meetkotresh J2EE 1 February 2nd, 2008 01:52 AM
java.lang.StackOverFlowError mrafeeq J2EE 1 August 10th, 2006 03:34 PM
java.lang.StackOverFlowError mrafeeq Pro Java 0 August 10th, 2006 12:51 PM
java.lang.Runtime mudasirw J2EE 1 August 2nd, 2005 02:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.