Topic: xsl transformation to uppercase (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=22057" title="Pages that link to Topic: xsl transformation to uppercase (Page 1 of 1)" rel="nofollow" >Topic: xsl transformation to uppercase <span class="small">(Page 1 of 1)</span>\

 
clockdva
Obsessive-Compulsive (I) Inmate

From:
Insane since: Jun 2004

posted posted 06-05-2004 15:43

sorry for my english but i'm from Naples

in a xsl file i have

<xsl:for-each select="azstring">
<azstring><xsl:value-of select="."/></azstring>
</xsl:for-each>

i know that if i write

<xsl:for-each select="azstring">
<azstring><xsl:value-of select="."/>HELLO!</azstring>
</xsl:for-each>

every string will finish with HELLO!


now i would like to know how can i make become every string uppercase(or also lowercase, for me it is the same)


thanks



Antonio

(Edited by clockdva on 06-05-2004 18:27)

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 06-05-2004 20:55

This is more of a style sheet type problem, you would want to assign a text-transform via your style sheet to transform the characters to upper case, or to lower case. XSL is not designed to modify the structure of the content, and your capitalization is a structural entity. The XSL is only resigned to redisplay your content into a different format, without modifying the actual content.

The purpose of XML is to allow for transmittion of content and not for the modification of content. Sorry.

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 06-05-2004 21:19
quote:
XSL is not designed to modify the structure of the content



I'm not sure I would entirely agree with that. First, the "structure" of the content would be the organization of the content within various XML tags, and that's exactly what XSLT is meant to transform. Second, it does provide some capabilities to modify the content itself. It may not be its primary purpose, but it can do it.

This page gives an example of how you can use the XSLT translate() function to do a case conversion:

http://www.vbxml.com/xml/articles/caseconvert/


 

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 06-05-2004 21:52

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

clockdva
Obsessive-Compulsive (I) Inmate

From:
Insane since: Jun 2004

posted posted 06-06-2004 14:36

thanks, tommorrow (in my office) i'll try.

the solution should be this:

<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>

<xsl:for-each select="azstring">
<azstring>
<xsl:value-of select="translate("."/,$lcletters,$ucletters)"/>
</azstring>
</xsl:for-each>


or maybe this


<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>

<xsl:for-each select="azstring">
<azstring>
<xsl:value-of select="translate(".",$lcletters,$ucletters)"/>
</azstring>
</xsl:for-each>


tomorrow i'll tell you



thanks


Antonio

(Edited by clockdva on 06-06-2004 14:38)

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 06-06-2004 20:34

select="translate(".",$lcletters,$ucletters)"

Careful! The XML parser will read that as

select="translate("

followed by garbage that it doesn't understand.

1. If you want to use quotes in an XML attribute, you must use thoe &quot; escape sequence:

select="translate(&quot;.&quot;,$lcletters,$ucletters)"

2. You don't want quotes here. If you use quotes, then you'll be taking the string ".", converting it to uppercase (which does nothing because it's just a period), and inserting it into the document.

Rather, I think you just want to use the . itself:

select="translate(.,$lcletters,$ucletters)"

I may be wrong; perhaps you need to use the current() function to refer to the current node:

select="translate(current(),$lcletters,$ucletters)"

It's been a while since I wrote any XSLT myself.


 

clockdva
Nervous Wreck (II) Inmate

From:
Insane since: Jun 2004

posted posted 06-07-2004 01:08

thanks tomorrow i ll'ltell you

clockdva
Nervous Wreck (II) Inmate

From:
Insane since: Jun 2004

posted posted 06-07-2004 10:34

thanksssssssssssssssssssssss
it works(probably)
it is the same to use only select="translate(.,$lcletters,$ucletters)"
or select="translate(current(),$lcletters,$ucletters)"
grazie

clockdva
Nervous Wreck (II) Inmate

From:
Insane since: Jun 2004

posted posted 06-07-2004 10:50

thankssssssssssssss



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu