Re: [xsl] Processing schema attributes with leading zeros?

Presumably it's a schema-aware transformation, in which case the typed
value of the month attribute is the integer 6. When you do select="." to
construct the new attribute, the effect is to select the old attribute
and atomize it, which gives the integer 6, and then to convert the
result to a string, which gives you the string "6".

You might do better with select="string(.)", which should give you the
string value of the old attribute node; but processors are allowed to
reconstruct the string value from the typed value if they choose.

Basically, by typing this attribute as an integer, you are saying that
leading zeroes aren't significant, which contradicts what you are
implying in your question, which is that they are significant.

The use of an XSD pattern to constrain a value to something other than
its canonical lexical form is always problematic with schema-aware XSLT
and XQuery. There's no way the processor can try to construct a
representation of an integer that matches a supplied pattern; regular
expressions just don't work that way.

Michael Kay
Saxonica

On 19/10/2012 16:49, dvint@xxxxxxxxx wrote:

I have the following elemnt content:
<issdate year="2012" month="06" day="15"/>

When I process it with the following templates I get this result:
<issueDate year="2012" month="6" day="15"/>

I'm trying to understand is why the leading 0 on the month was stripped.

So basically my code is renaming the element and then just copying the
attribute values through for this particular element. Why am I loosing the
leading 0? I'd really like to avoid having to know what the content might
be in all casses for attributes.