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

Discussion in 'XML' started by Yereth Jansen, Jan 19, 2004.

  1. 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
     
    Yereth Jansen, Jan 19, 2004
    #1
    1. Advertising

  2. In article <400c1a9a$0$66934$>,
    Yereth Jansen <> wrote:

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


    You mean

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

    -- Richard
    --
    Spam filter: to mail me from a .com/.net site, put my surname in the headers.

    FreeBSD rules!
     
    Richard Tobin, Jan 19, 2004
    #2
    1. Advertising

  3. Yereth Jansen

    Yereth Guest

    Richard Tobin wrote:
    >>translate({.}," ","_")

    >
    > 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
     
    Yereth, Jan 19, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ddfsdf
    Replies:
    0
    Views:
    366
    ddfsdf
    Oct 11, 2005
  2. Chris Theis
    Replies:
    2
    Views:
    486
    Chris Theis
    Jul 24, 2003
  3. tom_usenet
    Replies:
    0
    Views:
    549
    tom_usenet
    Jul 24, 2003
  4. Itchy
    Replies:
    1
    Views:
    342
    Victor Bazarov
    Aug 12, 2003
  5. johkar
    Replies:
    3
    Views:
    2,025
    johkar
    Jul 10, 2009
Loading...

Share This Page