OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

ubl-dev message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: Validating UBL examples with xmllint

At 2004-05-20 18:30 +0100, Pedro Alves wrote:
>On Thu, May 20, 2004 at 07:04:03PM +0300, G. Ken Holman wrote:
> >
> > XSLT and XPath questions would be better posted to the following list:
> >
> >   http://www.mulberrytech.com/xsl/xsl-list
> >
>     I know this is not the most correct place, but please answer me one
>more, since it is a practical example.

I do not mind at all, Pedro, as it is my profession to teach and consult in 
XML to worldwide clients, and indeed you are now asking these questions in 
the context of UBL I'm hoping the others on UBL-Dev will not find this out 
of scope.

>     I had my ubl Orders.xml beginning with <Order>.
>     In order to be precise, I changed the XML so that suns msv validates the

Why did MSV not validate the file before?  Oh, had you omitted the 
namespace declarations before?

>I know have:
><Order xmlns="urn:oasis:names:tc:ubl:Order:1:0"
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
>   <BuyersID>EW112429145</BuyersID>
>   <cbc:IssueDate>2004-01-17</cbc:IssueDate>
>However, my xls stylesheets stoped working.
>I made a few surfing and changed:
>     <xsl:template match="Order">

Ahhhhhhh, yes, the dreaded default namespace problem. :{)}

>     <xsl:template match="{urn:oasis:names:tc:ubl:Order:1:0}Order">

That is not the correct notation, but you do now understand what you need.

>But still gives errors.
>How can I handle this?

By declaring a namespace in your stylesheet and then using that explicitly.

The rule in XPath 1.0 is that the default namespace is *never* used in 
XPath expressions, so by saying match="Order" you are matching Order in no 

Do the following using any namespace you wish to use:

    <xsl:stylesheet ....

      <xsl:template match="pedro:Order">

      <xsl:template match="pedro:Order/ken:IssueDate">

Note that as editor of the UBL FPSC Formatting Specifications, I made sure 
that *every* XPath address in the formatting specifications used the 
appropriate namespace for every step; check out the example here:


Remember that namespace prefixes are arbitrary, not standardized (which is 
why I'm allowed to use our names as prefixes), but as a *convention* the 
entire UBL TC adopted the following set of namespace prefixes to use for 
documentary purposes only:


I documented this convention to LCSC here:


I hope this helps.

........................... Ken

Public courses: Spring 2004 world tour of hands-on XSL instruction
Next: 3-day XSLT/XPath; 2-day XSL-FO - Birmingham, UK June 14,2004

World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/u/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/u/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]