Hi,
I got some help to go from:
bbBusState to BB_BUS_STATE.
However I found out :-( that the xml contained attributes like:
TxDeviceGroup and that becomes:
_TX_DEVICE_GROUP
This is the code I got from Marrow (thanks Marrow :-)) (See below)
I must admit (Marrow) that I do not fully understand what the code
does so I am having problems to modify it to remove the underscore
for attributes that begins with a cap.
I have tried to add the following code (see My code below).
My strings became a mess :-(
//Mikael
My code
=======
<xsl:choose>
<xsl:when test="starts-with($u-str,'|')">
<xsl:variable name="u-str-len" select="string-length($u-str)"/>
<xsl:variable name="u-str-rest" select="substring($u-str,2,$u-str-len)"/>
<xsl:variable name="str-first-chr" select="substring($str,1,1)"/>
<xsl:call-template name="Camel2Underscore">
<xsl:with-param name="u-str" select="concat($str-first-chr,
$u-str-rest)"/>
</xsl:call-template>
</xsl:when>
================================================== =====
<xsl:template name="Camel2Underscore">
<xsl:param name="str"/>
<xsl:param name="u-str"
select="translate($str,$ucase,'||||||||||||||||||| |||||||')"/>
<!-- Here I tested to add my code -->
<xsl:choose>
<xsl:when test="substring($u-str,1,1) = '|'">
<xsl:text>_</xsl:text>
<xsl:value-of select="substring($str,1,1)"/>
<xsl:call-template name="Camel2Underscore">
<xsl:with-param name="str" select="substring($str,2)"/>
<xsl:with-param name="u-str" select="substring($u-str,2)"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($u-str,'|')">
<xsl:variable name="runlen"
select="string-length(substring-before($u-str,'|'))"/>
<xsl:value-of
select="translate(substring($str,1,$runlen),$lcase ,$ucase)"/>
<xsl:call-template name="Camel2Underscore">
<xsl:with-param name="str" select="substring($str,$runlen + 1)"/>
<xsl:with-param name="u-str" select="substring($u-str,$runlen +
1)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate($str,$lcase,$ucase)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet> 4 2978
Without having to know the code that you were using, there are simple ways
to remove the leading underscore:
1.
<xsl:variable name="vresult1">
<xsl:call-template name="capitalize">
<xsl:with-param name="str" select="$someStr"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="theResult" select="substring($vresult1, 1 +
contains($allCaps, substring($someStr, 1, 1)))"/>
2.
<xsl:variable name="vresult1">
<xsl:call-template name="capitalize">
<xsl:with-param name="str" select="substring($someStr, 2)"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="theResult" select="concat(translate(substring($someStr,
1, 1), $lowercase, $allCaps), $vresult1)"/>
=====
Cheers,
Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL
"Mikael Petterson" <mi*************@hotmail.com> wrote in message
news:Ia_ab.5421$P51.8313@amstwist00... Hi,
I got some help to go from:
bbBusState to BB_BUS_STATE.
However I found out :-( that the xml contained attributes like:
TxDeviceGroup and that becomes:
_TX_DEVICE_GROUP
This is the code I got from Marrow (thanks Marrow :-)) (See below) I must admit (Marrow) that I do not fully understand what the code does so I am having problems to modify it to remove the underscore for attributes that begins with a cap.
I have tried to add the following code (see My code below).
My strings became a mess :-(
//Mikael
My code ======= <xsl:choose> <xsl:when test="starts-with($u-str,'|')"> <xsl:variable name="u-str-len" select="string-length($u-str)"/> <xsl:variable name="u-str-rest"
select="substring($u-str,2,$u-str-len)"/> <xsl:variable name="str-first-chr" select="substring($str,1,1)"/> <xsl:call-template name="Camel2Underscore"> <xsl:with-param name="u-str" select="concat($str-first-chr, $u-str-rest)"/> </xsl:call-template> </xsl:when>
================================================== =====
<xsl:template name="Camel2Underscore"> <xsl:param name="str"/> <xsl:param name="u-str" select="translate($str,$ucase,'||||||||||||||||||| |||||||')"/>
<!-- Here I tested to add my code -->
<xsl:choose> <xsl:when test="substring($u-str,1,1) = '|'"> <xsl:text>_</xsl:text> <xsl:value-of select="substring($str,1,1)"/> <xsl:call-template name="Camel2Underscore"> <xsl:with-param name="str" select="substring($str,2)"/> <xsl:with-param name="u-str" select="substring($u-str,2)"/> </xsl:call-template> </xsl:when> <xsl:when test="contains($u-str,'|')"> <xsl:variable name="runlen" select="string-length(substring-before($u-str,'|'))"/> <xsl:value-of select="translate(substring($str,1,$runlen),$lcase ,$ucase)"/> <xsl:call-template name="Camel2Underscore"> <xsl:with-param name="str" select="substring($str,$runlen + 1)"/> <xsl:with-param name="u-str" select="substring($u-str,$runlen + 1)"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="translate($str,$lcase,$ucase)"/> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>
Hmmmmmmm.... Simple for you yeah. Not for me.
You first define a variable called vresult1 then you call a
template called capitalize. And you send, I assume _TR_DEVICE_GROUP to
that template. Then you define a variable that is called theResult. I
guess this is where we get the TR_DEVICE_GROUP output. Which part do I
need to implement?
//Mikael
Dimitre Novatchev wrote: Without having to know the code that you were using, there are simple ways to remove the leading underscore:
1. <xsl:variable name="vresult1"> <xsl:call-template name="capitalize"> <xsl:with-param name="str" select="$someStr"/> </xsl:call-template> </xsl:variable>
<xsl:variable name="theResult" select="substring($vresult1, 1 + contains($allCaps, substring($someStr, 1, 1)))"/>
2. <xsl:variable name="vresult1"> <xsl:call-template name="capitalize"> <xsl:with-param name="str" select="substring($someStr, 2)"/> </xsl:call-template> </xsl:variable>
<xsl:variable name="theResult" select="concat(translate(substring($someStr, 1, 1), $lowercase, $allCaps), $vresult1)"/>
===== Cheers,
Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL "Mikael Petterson" <mi*************@hotmail.com> wrote in message news:Ia_ab.5421$P51.8313@amstwist00...
Hi,
I got some help to go from:
bbBusState to BB_BUS_STATE.
However I found out :-( that the xml contained attributes like:
TxDeviceGroup and that becomes:
_TX_DEVICE_GROUP
This is the code I got from Marrow (thanks Marrow :-)) (See below) I must admit (Marrow) that I do not fully understand what the code does so I am having problems to modify it to remove the underscore for attributes that begins with a cap.
I have tried to add the following code (see My code below).
My strings became a mess :-(
//Mikael
My code ======= <xsl:choose> <xsl:when test="starts-with($u-str,'|')"> <xsl:variable name="u-str-len" select="string-length($u-str)"/> <xsl:variable name="u-str-rest"
select="substring($u-str,2,$u-str-len)"/>
<xsl:variable name="str-first-chr" select="substring($str,1,1)"/> <xsl:call-template name="Camel2Underscore"> <xsl:with-param name="u-str" select="concat($str-first-chr, $u-str-rest)"/> </xsl:call-template> </xsl:when>
================================================ =======
<xsl:template name="Camel2Underscore"> <xsl:param name="str"/> <xsl:param name="u-str" select="translate($str,$ucase,'||||||||||||||||| |||||||||')"/>
<!-- Here I tested to add my code -->
<xsl:choose> <xsl:when test="substring($u-str,1,1) = '|'"> <xsl:text>_</xsl:text> <xsl:value-of select="substring($str,1,1)"/> <xsl:call-template name="Camel2Underscore"> <xsl:with-param name="str" select="substring($str,2)"/> <xsl:with-param name="u-str" select="substring($u-str,2)"/> </xsl:call-template> </xsl:when> <xsl:when test="contains($u-str,'|')"> <xsl:variable name="runlen" select="string-length(substring-before($u-str,'|'))"/> <xsl:value-of select="translate(substring($str,1,$runlen),$lca se,$ucase)"/> <xsl:call-template name="Camel2Underscore"> <xsl:with-param name="str" select="substring($str,$runlen + 1)"/> <xsl:with-param name="u-str" select="substring($u-str,$runlen + 1)"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="translate($str,$lcase,$ucase)"/> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>
"Mikael Petterson" <mi*************@hotmail.com> wrote in message
news:KJ%ab.5445$P51.8312@amstwist00... Hmmmmmmm.... Simple for you yeah. Not for me.
You first define a variable called vresult1 then you call a template called capitalize. And you send, I assume _TR_DEVICE_GROUP to that template.
No. I pass to it "TrDeviceGroup"
As result the value of $vresult1 will be _TR_DEVICE_GROUP
The "capitalize" template is all you had at the moment (regardless if it
were Marrow's solution, or the FXSL-based solution I proposed).
Then you define a variable that is called theResult. I guess this is where we get the TR_DEVICE_GROUP output.
Yes.
Which part do I need to implement?
Absolutely nothing to implement -- just define the variables in this way.
=====
Cheers,
Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL
Hi,
Thanks for the explanation. It really helped me out. You saved me since
I needed to write a code generator and discovered some inconsistencies.
Thanks again!! Have a nice evening!
//Mikael
Dimitre Novatchev wrote: "Mikael Petterson" <mi*************@hotmail.com> wrote in message news:KJ%ab.5445$P51.8312@amstwist00...
Hmmmmmmm.... Simple for you yeah. Not for me.
You first define a variable called vresult1 then you call a template called capitalize. And you send, I assume _TR_DEVICE_GROUP to that template.
No. I pass to it "TrDeviceGroup"
As result the value of $vresult1 will be _TR_DEVICE_GROUP
The "capitalize" template is all you had at the moment (regardless if it were Marrow's solution, or the FXSL-based solution I proposed).
Then you define a variable that is called theResult. I guess this is where we get the TR_DEVICE_GROUP output.
Yes.
Which part do I need to implement?
Absolutely nothing to implement -- just define the variables in this way.
===== Cheers,
Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: christopher keller |
last post by:
Hello,
Using MS Access 97, SR2 mit MDAC 2.7 / 2.8 English/Deutsch we get the
old problem of 'object not found' in DB2 Connect Version 8. ( From MS
KB Q129814: "When you try to attach a DB2...
|
by: ajikoe |
last post by:
Hi,
I tried to follow the example in swig homepage.
I found error which I don't understand.
I use bcc32, I already include directory where my python.h exist in
bcc32.cfg.
/* File : example.c...
|
by: krema2ren |
last post by:
Hi
I've the following header problem that I need two classes to know each
other through a boost::shared_ptr. Does any of you smart guys have a
solution?
A.h
----------------------
#include...
|
by: axel22 |
last post by:
I'm using the MSVisual Studio 2003, and I tried creating a template
class.
This generated a well known problem when I tried putting the class
member
definitions in another source file (.cpp).
I...
|
by: kalki70 |
last post by:
Hi,
I'm working with templates, but I have a syntax problem I don't know
how to fix.
I built a small example, so maybe you can tell me how to write
correctly this code.
I have 2 files :...
|
by: shuisheng |
last post by:
Dear All;
Would you please help me to look at the following case:
//! Rotation.
enum Rotation {
NON_CYCLIC,
CYCLIC
};
//! Rotation.
|
by: daroman |
last post by:
Hi Guys,
i've problem with my small C++ programm. I've just small template
class which represetns a array, everything works fine up to
combination with std::string. I did tried it with M$ VC++ and...
|
by: chris |
last post by:
Guys, I have the following piece of code. Could you please help me understand why
b.ToString( ) cannot be called while b.foo( ) can? When I compile I get (gcc, but
visual studio gives the same...
|
by: abir |
last post by:
i have a template as shown
template<typename Sclass Indexer{};
i want to have a specialization for std::vector both const & non const
version.
template<typename T,typename Aclass...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |