Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > xml/xslt external function

Reply
Thread Tools

xml/xslt external function

 
 
Une Bévue
Guest
Posts: n/a
 
      02-04-2008

i want to use an external ruby function "w3ready " within an xsl ssheet
in order to transform a given text to unaccentuated.

calling the function :

<xsl:template match="/xCard">
[...]
<xsl:for-each select="GRPS/GRP/*">
<xsl:variable name="group_label" select="text()"/>
<xsl:variable name="page_name"
select="ex:w3ready($group_label)"/>
[...]

part of the xml :

<xCard>
<GRPS>
<GRP>AB2Web</GRP>
<GRP>Amis</GRP>
[...]
<GRP>Santé</GRP>
<GRP>Tourisme</GRP>
<GRP>Vignerons</GRP>
</GRPS>
<vCard>
<VERSION>2.0</VERSION>
<ID>@uid</ID>
<PHOTO>company.png</PHOTO>
<GRP>Négociant</GRP>
[...]

the ruby function :

def w3ready( label )
puts "label = #{label}, label.class = #{label.class}"
s = ""
case( label.class.to_s )
when "Array"
s = label[ 0 ].u.www_ready
when "String"
s = label.u.www_ready
end
return s
end

i'm surprised here to get an Array instead of a String ( the reason for
the case when...)

#u.www_ready transforms "Maison de la Santé" into "maison_de_la_sante"
in order to build a file name.

the Array i get is of only one element...

where is my mistake here ?
--
Une Bévue
 
Reply With Quote
 
 
 
 
Tim Perrett
Guest
Posts: n/a
 
      02-06-2008
What XSLT parser are you using?
Ive just done a load of XSLT work and im not sure this is possible??

Cheers

Tim
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
a member function call an external function with same name yuanhp_china@hotmail.com C++ 1 02-09-2007 04:19 PM
a member function call an external function with same name yuanhp_china@hotmail.com C++ 0 02-09-2007 04:14 PM
inner function calling external function John Smith Javascript 0 03-17-2005 06:10 PM
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM
unresolved external symbol/using an external dll Scott Allen C++ 8 05-02-2004 06:11 PM



Advertisments