Newbie: translate() within <template name="">

Y

Yereth Jansen

Hi everyone,

I have a question about an xslt document I'm producing. Hope I'm in the
right group for that, but I didn't find any other relevant groups on my
news-server.

I had a piece of code:
<xsl:template match="key">
<xsl:element name="{.}">
<xsl:value-of select="following-sibling::integer
following-sibling::string"/>
<xsl:apply-templates select="dict"/>
</xsl:element>
</xsl:template>

Which worked fine, but the "name" attribute of element can contain spaces..
Which is obviously a problem. I wanted to fix this by using the function:
translate({.}," ","_"), but I don't know if I'm using the '{.}' correctly
and I somehow can't get it in the "name" argument without the 'compiler'
complaining.
Can anyone help me with how to translate the spaces to underscores here?

Thanks in advance,
Yereth
 
Y

Yereth

Richard said:
You mean

{translate(., " ", "_")}

-- Richard

Exactly. :) Thank you very much. Just getting into xml and xslt and it's
nothing like any language I've programmed in before. Really have to get
used to all of this.

Yereth
 

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,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top