xml/xslt external function

U

Une Bévue

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

Tim Perrett

What XSLT parser are you using?
Ive just done a load of XSLT work and im not sure this is possible??

Cheers

Tim
 

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
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top