[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

xml/xslt external function

unbewusst.sein

2/4/2008 8:34:00 AM


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

Tim Perrett

2/6/2008 11:07:00 AM

0

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