473,396 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to format gMonth?

<report month="--07--">

in XSLT, how to format to e.g. Jul

I have tried using format-date but didn;t work

p.s. I am using saxon 8

Oct 13 '07 #1
3 2328
howa wrote:
<report month="--07--">
in XSLT, how to format to e.g. Jul
Table lookup, as in any other programming language. Extract the number,
use it to index into a table of strings.

For example, set up a string "JanFebMarAprMay..." and using substring
(subtract one from month number, multiply by three, use that as the
starting offset and 3 as the length).

Some other approaches are shown in
http://www.dpawson.co.uk/xsl/sect2/N4995.html

(Obviously, you'll also need to use substring or something like it to
extract the month digits from that value.)
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Oct 13 '07 #2
On 10 13 , 11 42 , Joe Kesselman <keshlam-nos...@comcast.netwrote:
howa wrote:
<report month="--07--">
in XSLT, how to format to e.g. Jul

Table lookup, as in any other programming language. Extract the number,
use it to index into a table of strings.
yeah, this must work sure.

but as i am using XSLT 2.0, i believe i have a better way to do it? Or
why should I use gMonth in the schema?

I can just simply use a integer or string.

Thanks anyway

Oct 13 '07 #3
howa wrote:
or why should I use gMonth in the schema?
You asked what the Schema-standard way to represent a month is.
gMonth is it.

You use it the same reason you use other schema types -- because you
want schema to check that it's in the right range, and/or because you
want schema-aware applications to automatically do something reasonable
with it.
I can just simply use a integer or string.
You certainly can. You can even use an integer that's limited to the
1-12 range, or a string that is one of a limited set of values, if you
set the schema up appropriately. But then nobody but you knows what its
semantic meaning is. That may or may not matter to you, depending on
what you're doing with the data now and what you intend to do with it in
the future.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Oct 13 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Lowell Kirsh | last post by:
In Peter Norvig's Infrequently Answered Questions he explains that the following 2 fnctions look almost identical but are not the same: def printf(format, *args): print format % args, def...
15
by: Simon Brooke | last post by:
I'm investigating a bug a customer has reported in our database abstraction layer, and it's making me very unhappy. Brief summary: I have a database abstraction layer which is intended to...
3
by: stevek | last post by:
How do I format an integer. Add commas. 1234565 1,234,565 TIA
6
by: Dario Di Bella | last post by:
Hi all, we have the following urgent issue affecting our development team. Initially we had one particular workstation that failed executing queries on a DB2 database, raising an invalid date...
11
by: Grumble | last post by:
Hello, I have the following structure: struct foo { char *format; /* format string to be used with printf() */ int nparm; /* number of %d specifiers in the format string */ /* 0 <= nparm <=...
4
by: David Morris | last post by:
Hi Could somebody please explain what the following line of code means String.Format("{0}\{1}.{2:00}", C:\, myfile.txt, 1 It's actually the first argument that I don't understand. What is...
13
by: Roy | last post by:
Hi all, I'm creating a project that should always use this date format when displays the dates or create dates. The back end database is a SQL Server and I like to know what is the logical way...
2
by: Lord0 | last post by:
Hi there, Am I correct when I say that "--12" is a valid value for an xs:gMonth data-type in a schema but "12" is not? Similarly for an xs:gDay, "---30" is a valid value but "30" is not? ...
3
by: Carl Trachte | last post by:
Hello. Python 3.0.a1 has been released. I'm trying to get the hang of the new string formatting in the form: '5.66' There are more options in PEP 3101 (fill, alignment, etc.), but I'm having...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.