Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


XLS and selecting values based on xsi:type

From: "Rob W" <Whllrob@---.--->
To: NULL
Date: 11/7/2007 12:57:00 AM

Greetings,

My XML schema defines a customer to be of type UK or Non-UK European the 
difference between them is they have an addition TWO extra fields from the 
defined customer complex type.

Extract from XML file.
<Customer xsi:type="UKCustomer">

<CustomerName>Ford Motors</CustomerName>

<CustomerCode>123456789A</CustomerCode>

<CustomerAddressLine1>10 Harvard Road</CustomerAddressLine1>

<CustomerAddressLine2>Fenton</CustomerAddressLine2>

<CustomerAddressLine3>Stoke-on-Trent</CustomerAddressLine3>

<CustomerAddressLine4>Staffordshire</CustomerAddressLine4>

<CustomerCountry>United Kingdom</CustomerCountry>

<CustomerSigneeName>Trevor Thames</CustomerSigneeName>

<CustomerSigneeSignature>T.Thames</CustomerSigneeSignature>

<CustomerPostCode>ST2 9DS</CustomerPostCode>

</Customer>

UK customer additionaly have CustomerCounty & CustomerPostcode

Non-UK European have CustomerAddressline5(optional) & Timezone(I dont need 
to print this)

However in my XSL I'm hardcoding the values in (see code below)

I've looked at <xsl:if> but dont know how to compare the complex xsi type.

Can anyone help please to suggest away I only print the fields based on the 
xsi type??
Also as Addressline5 is optional is there a way to check if the field is 
present i.e. nulls?

I guess I could just reference all fields and if there empty or not present 
they wont print, but I'm sure there's a much better solution outthere.

Thanks
Rob

Extract from XSL File
<td align="justify" valign="top">

<xsl:value-of select="my:PODBatch/my:POD/my:Customer/my:CustomerName"/><br/>

<xsl:value-of 
select="my:PODBatch/my:POD/my:Customer/my:CustomerAddressLine1"/><br/>

<xsl:value-of 
select="my:PODBatch/my:POD/my:Customer/my:CustomerAddressLine2"/><br/>

<xsl:value-of 
select="my:PODBatch/my:POD/my:Customer/my:CustomerAddressLine3"/><br/>

<xsl:value-of 
select="my:PODBatch/my:POD/my:Customer/my:CustomerAddressLine4"/><br/>

<xsl:value-of 
select="my:PODBatch/my:POD/my:Customer/my:CustomerCountry"/><br/>

<xsl:value-of 
select="my:PODBatch/my:POD/my:Customer/my:CustomerPostcode"/><br/>

</td>






transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent