Altova Mailing List Archives


Re: [xsl] RE: Replacing the space character with another character

From: mozer <xmlizer@--------->
To:
Date: 5/14/2007 7:25:00 AM
Can you give the first few lines of your XSLT stylesheet (say until
the first xsl:template) ?


On 5/14/07, Mark Peters <flickrmeister@xxxxxxxxx> wrote:
Thank you both. I'm using Xalan. Although I tried replacing
translate(.,'&#x20;','&#x26;') with translate(.,' ','*'), my indexterm
spaces still disappear -- they don't get replaced with either an ampersand
or an asterisk, as specified.

Maybe I need to replace my processor.



Mark



On 5/13/07, mozer <xmlizer@xxxxxxxxx> wrote:
>
> &#x26; --> &
> &#x2A; --> *
>
> Xmlizer
>
> On 5/13/07, Mark Peters <flickrmeister@xxxxxxxxx> wrote:
> > Hi,
> >
> > I'm trying to replace the space character with another character (I've
> > chosen the asterisk, but it could be anything) in a specific element's
> text
> > contents. I've read the Replace and String Replace pages on Dave
> Pawson's
> > site, and have read about the translate XPath function, but am still
> coming
> > up empty (literally!).
> >
> >
> > In my input XML, I have a number of <indexterm> elements such as the
> > following:
> >
> >  <indexterm>Greek History</indexterm>
> >
> >
> > I'd like to replace the space character as follows:
> >
> >  <indexterm>Greek*History</indexterm>
> >
> >
> > My stylesheet contains the following template:
> >
> >  <xsl:template match="indexterm">
> >     <indexterm>
> >        <xsl:value-of select="translate(.,'&#x20;','&#x26;')"/>
> >     </indexterm>
> >  </xsl:template>
> >
> >
> > For some reason, the stylesheet removes the spaces, rather than
> replacing
> > them with the asterisk:
> >
> >  <indexterm>GreekHistory</indexterm>
> >
> >
> > What am I doing wrong?
> >
> > Thanks,
> > Mark

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.