 |
| 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
|
|
|
|

January 28th, 2008, 08:13 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
|
|
You still need to wrap the <xsl:for-each> instruction in a <xsl:template match="/"> declaration.
/- Sam Judson : Wrox Technical Editor -/
|
|

January 28th, 2008, 08:29 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
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
|
|

January 28th, 2008, 08:59 AM
|
|
Authorized User
|
|
Join Date: Jan 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

January 28th, 2008, 09:01 AM
|
|
Authorized User
|
|
Join Date: Jan 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

January 28th, 2008, 09:11 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
|
|
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 -/
|
|

January 28th, 2008, 12:00 PM
|
|
Authorized User
|
|
Join Date: Jan 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

January 28th, 2008, 12:05 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
|
|
You can do a test based on position(), e.g.
<xsl:if test="position() > 1">
</xsl:if>
/- Sam Judson : Wrox Technical Editor -/
|
|

January 29th, 2008, 03:12 AM
|
|
Authorized User
|
|
Join Date: Jan 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thanks a lot for this also,
one more doubt : is the Latest Xalan parser is supporting the XSLT 2.0
|
|

January 29th, 2008, 05:09 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
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
|
|

January 29th, 2008, 09:51 AM
|
|
Authorized User
|
|
Join Date: Jan 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|
 |