problems with xslt4r

R

Ralf Müller

Hi,

I'd like to use 'xslt4r', because i cannot install libxml2 + libxslt for
libxslt (ruby).
But i get theses errors when invoking xpath from 'xmlscan':

ram@lilith:~/src/xml$irb
irb(main):001:0> require 'xpath'
/usr/local/lib/ruby/site_ruby/1.8/xpath.rb:10: warning: Object#type is
deprecated; use Object#class
=> true
irb(main):002:0>

and if i try to apply the sheet on the test-data:

ram@lilith:~/src/tar/xslt4r-0.0.2/test$ls
data.xml stylesheet.xsl stylesheet2.xsl test.xml test_style.xsl
ram@lilith:~/src/tar/xslt4r-0.0.2/test$ruby -rxslt test_style.xsl test.xml
/usr/local/lib/ruby/site_ruby/1.8/xpath.rb:10: warning: Object#type is
deprecated; use Object#class
test_style.xsl:1: parse error
<xsl:stylesheet xmlns:xsl="http://www.fantasy-coders.de/xslt">
^
test_style.xsl:1: parse error
<xsl:stylesheet xmlns:xsl="http://www.fantasy-coders.de/xslt">
^

with:
ram@lilith:~/src/tar/xslt4r-0.0.2/test$ruby -v
ruby 1.8.2 (2004-05-26) [i686-linux]


is this version of xslt4r to old?
Anyway, does anyone know an easy way to apply stylesheets with ruby without
having libxml, libxslt(C-Lib) installed?

regards
ralf
 
M

Michael Neumann

Ralf said:
Hi,

I'd like to use 'xslt4r', because i cannot install libxml2 + libxslt for
libxslt (ruby).
But i get theses errors when invoking xpath from 'xmlscan':

ram@lilith:~/src/xml$irb
irb(main):001:0> require 'xpath'
/usr/local/lib/ruby/site_ruby/1.8/xpath.rb:10: warning: Object#type is
deprecated; use Object#class

This is only a warning. It's easy to fix. Every occurence of type (not
as local variable) should be replaced by self.class.
=> true
irb(main):002:0>

and if i try to apply the sheet on the test-data:

ram@lilith:~/src/tar/xslt4r-0.0.2/test$ls
data.xml stylesheet.xsl stylesheet2.xsl test.xml test_style.xsl
ram@lilith:~/src/tar/xslt4r-0.0.2/test$ruby -rxslt test_style.xsl test.xml
/usr/local/lib/ruby/site_ruby/1.8/xpath.rb:10: warning: Object#type is
deprecated; use Object#class
test_style.xsl:1: parse error

aha.... you're trying to run a XSLT file as Ruby code :)

try this:

ruby xslt.rb test_style.xsl test.xml
is this version of xslt4r to old?

it's quite old and uncomplete!
Anyway, does anyone know an easy way to apply stylesheets with ruby without
having libxml, libxslt(C-Lib) installed?

Regards,

Michael
 
R

Ralf Müller

Am Donnerstag, 15. Juli 2004 14:55 schrieb Michael Neumann:
try this:

ruby xslt.rb test_style.xsl test.xml

I did and with type -> class replacement, i get no more errors. But i also get
no output.
I'm not sure about, what should be produced. How can I get te result of the
stylesheet-application?

thanks
ralf
 
M

Michael Neumann

Ralf said:
Am Donnerstag, 15. Juli 2004 14:55 schrieb Michael Neumann:



I did and with type -> class replacement, i get no more errors. But i also get
no output.
I'm not sure about, what should be produced. How can I get te result of the
stylesheet-application

should be printed on stdout.

try:

ruby xslt.rb test/stylesheet.xsl test/data.xml

Regards,

Michael
 
M

Michael Neumann

Ralf said:
Now, it works fine.


Does xslt4r support different namespaces?

can you give a short example?

xslt4r is in an alpha-stage. the last update was at the end of 2001!


Regards,

Michael
 
R

Ralf Müller

--------------Boundary-00=_JFOXHKZOOK95XFHJ3EJD
Content-Type: Multipart/Mixed;
boundary="------------Boundary-00=_JFOXHKZOOK95XFHJ3EJD"


--------------Boundary-00=_JFOXHKZOOK95XFHJ3EJD
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Am Donnerstag, 15. Juli 2004 18:05 schrieb Michael Neumann:
can you give a short example?

xslt4r is in an alpha-stage. the last update was at the end of 2001!

I want to apply 'lcwa2sql.xsl' on 'lcwa-short.dia'. Using xsltproc from=20
libxslt, i get 'lcwa.sql'. But 'ruby xslt.rb lcwa2sql.xsl lcwa-short.dia'=
=20
produces no output.
I actually need a way to apply the stylesheets without upgrading our=20
production system to libxml and libxslt. And because of my growing addict=
ion=20
to ruby, i came accross xslt4r.

maytheforcebewithyou
ralf
--------------Boundary-00=_JFOXHKZOOK95XFHJ3EJD
Content-Type: text/xml;
charset="iso-8859-1";
name="lcwa2sql.xsl"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="lcwa2sql.xsl"

<?xml version="1.0" encoding="ISO8859-1"?>
<!-- author: Ralf Mueller -->
<!-- this stylesheet is tested with xstlproc from the libxslt library -->
<!-- This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dia="http://www.lysator.liu.se/~alla/dia/"
version="1.0">
<xsl:eek:utput method="text" encoding="iso8859-1"/>
<xsl:template match="/">
use test;
<xsl:apply-templates select="dia:diagram"/>
</xsl:template>

<xsl:template match="dia:diagram">
<xsl:for-each select="dia:layer[@name='Hintergrund']">
<xsl:for-each select="dia:eek:bject[@type='UML - Class']">
<xsl:text>CREATE TABLE IF NOT EXISTS </xsl:text>
<xsl:apply-templates select="dia:attribute[@name='name']"/>(<xsl:apply-templates select="dia:attribute[@name='attributes']"/>);
</xsl:for-each>
</xsl:for-each>
</xsl:template>

<xsl:template match="dia:attribute[@name='name']">
<xsl:value-of select="translate(.,'#','')"/>
</xsl:template>

<xsl:template match="dia:attribute[@name='attributes']">
<xsl:for-each select="dia:composite[@type='umlattribute']">
<xsl:for-each select="dia:attribute">
<xsl:if test="./@name = 'name' or
./@name = 'type'">
<xsl:value-of select="translate(.,'#','')"/>
</xsl:if>
</xsl:for-each>
NOT NULL <xsl:if test="position() &lt; last()">,</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

--------------Boundary-00=_JFOXHKZOOK95XFHJ3EJD
Content-Type: application/x-gzip;
name="lcwa-short.dia.gz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="lcwa-short.dia.gz"

H4sICEZ+90AAA2xjd2Etc2hvcnQuZGlhAO1dzXbbNhbe+yk4yqLtjESLpCiJTZ0eN52M5zRxciZJ
F934QCJEIoZADQBathfzKrOZZ+iqO7/YAKRsmb+iSFGuFdgnsUlf3g9/H+7FxSX0w4/Xc6xdQcpQ
QE46ht7vaJBMAxcR76Tz+dOb3rjz46ujH1wEvhf/PArmmniCMHl10vE5X3x/fLxcLnV8wwAPqI5R
qDN4/B+AMTgWQscd8fhfej3t8gtzZz5ml4jNvCP25dKdaUeuNzsSd49mnj87Er95/lGv9+pI0x4j
uoADeW91F3BO0STkUCNgDk86EzC99GgQErcTS63kpgEOqHYF8EnnxSz66hyv1Bwn9JToXoAFpGm1
80XAkBDhN4uMSIEe+f8jmZUUE0LEe/XidPAiLtLqxlpXXkELQfgcUA+RLA6FAMcN0dft+0bYXv+k
Zf24Zf20Zf2IXSwCyilAPIsxCQIMAYlhOA1hfRw2BVgMk/J6mCPDto36IDPEedBqNQTCErncz4Ig
wmOAQSPtPkSen9MVD+rNCurj2w+k33YC8SjKTEvJ+SMhUaAlaqeL67Ieb9DVsfablrRfIYYmGOaV
/qEjdqA+p/hbqW/azyFyIdvQ00mZAk3+Sux4U8XTclVrEN9K2dYIAoMbSFfq3wVuiGFHW7XviuyP
WiCYfIFTvqraRw6IC6ir9bQPAb7xAtJZexXCp0DuSed9P9k86QoJhWL+zLTPIlhPB07X6acrnO3J
IuWTSVo3FTUAxMMw1t/r6327O3Z0x37pDOXvhmmJH/UgF6IhLqLSb1GnrMCoioBTJuAMNwsYxqgU
Y1RFwrTKJERNG0v0KwgYpa0lMYyagwgRAulF5Feme/Sxswlt+V0PgvnB8iLHo91sfrdBEe4DvGD8
BsM0ACThPDNp5k+Dx+tZoNG0YDSdFsb97sBqcVoYyQmhOzDX04JttjwrpKqUS9mNArZZJiAgHgso
Hjw1D8zG5nHcLg8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IFfMkg8RBDxNW+DeSbw0tA5XMMQR9qbyB2tW8W
QmgpfKdvvlM7/XlQaqe/BpLa6a/NHbXTr3b6y7tL7fQnpLcN5RYetFlSgUKwr3E3MnZIZEA38jje
rX0sdaJWGdYh7ovce4+KUA0I9WHViFk6aeef377VxJX2MwSXHF0Jyx8SLxL8LfTEopNFB+PGXv/+
2dfwEyoU+8rLvHlXcurvf2fywE5jOF814p/AmKn9yiel01VAFZuKdFdNAY3bUJHpaycTF4rVO7NN
qPRJtqAi0p+YSCqLJrEz1/hTqC1DH9rDrmm2mkojUfrDbs/o68bLgaVb45HZNcXPNnNpcquWI2ZV
Eek5evmHwKdFVB5NcgJWeTT5ECqPprLT9Bw682+qM/eUR5NJhTGyE3RJJs0onYeTmX42ZtLE16sP
t4svxD+Pgvmro/8D346IU6OOAAA=

--------------Boundary-00=_JFOXHKZOOK95XFHJ3EJD
Content-Type: text/plain;
charset="iso-8859-1";
name="lcwa.sql"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="lcwa.sql"


use test;
CREATE TABLE IF NOT EXISTS
haeuser
(
hauscode

CHAR(10)

NOT NULL ,
landcode

CHAR(10)

NOT NULL ,
name

CHAR(40)

NOT NULL ,
adrplz

CHAR(5)

NOT NULL ,
adrort

CHAR(30)

NOT NULL ,
adrstrasse

CHAR(30)

NOT NULL ,
adrhausnr

CHAR(10)

NOT NULL ,
telnr

CHAR(20)

NOT NULL ,
faxnr

CHAR(20)

NOT NULL ,
email

CHAR(20)

NOT NULL );
CREATE TABLE IF NOT EXISTS
abteilungen
(
hauscode

CHAR(10)

NOT NULL ,
abtcode

CHAR(10)

NOT NULL ,
abtnr

INT

NOT NULL ,
name

CHAR(40)

NOT NULL );
CREATE TABLE IF NOT EXISTS
mitarbeiter
(
user

CHAR(10)

NOT NULL ,
passwort

CHAR(10)

NOT NULL ,
nachname

CHAR(30)

NOT NULL ,
vorname

CHAR(30)

NOT NULL ,
titel

CHAR(20)

NOT NULL );

--------------Boundary-00=_JFOXHKZOOK95XFHJ3EJD--

--------------Boundary-00=_JFOXHKZOOK95XFHJ3EJD--
 
M

Michael Neumann

Ralf said:
Am Donnerstag, 15. Juli 2004 18:05 schrieb Michael Neumann:



I want to apply 'lcwa2sql.xsl' on 'lcwa-short.dia'. Using xsltproc from
libxslt, i get 'lcwa.sql'. But 'ruby xslt.rb lcwa2sql.xsl lcwa-short.dia'
produces no output.
I actually need a way to apply the stylesheets without upgrading our
production system to libxml and libxslt. And because of my growing addiction
to ruby, i came accross xslt4r.

sorry, but I no more develop xslt4r. it was just a proof of concept hack
(at a boring weekend).

regards,

Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,148
Messages
2,570,838
Members
47,385
Latest member
Joneswilliam01

Latest Threads

Top