Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: ok, must be doing something stupid but HELP (XSL problem) [Thread Next] Re: ok, must be doing something stupid but HELP (XSL problem)To: NULL Date: 3/12/2009 1:37:00 PM For those following along here is what I came up with so far (and it
works):
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform" xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
xmlns:jdf="http://www.CIP4.org/JDFSchema_1_1" xmlns:pt="http://
www.printtalk.org/schema"
exclude-result-prefixes="pt">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/
>
<xsl:template match="/">
<Order>
<xsl:attribute name="orderDate"><xsl:value-of select="pt:PrintTalk/
@timeStamp"/></xsl:attribute>
<xsl:attribute name="OrderID"><xsl:value-of select="pt:PrintTalk/
pt:Request/pt:PurchaseOrder/@BusinessID"/></xsl:attribute>
<xsl:attribute name="CustomerID"><xsl:value-of select="pt:PrintTalk/
pt:Header/pt:From/pt:Credential/pt:Identity"/></xsl:attribute>
<xsl:element name="Address">
<xsl:attribute name="AddressID">1</xsl:attribute>
<firstname>
<xsl:value-of select="pt:PrintTalk/pt:Request/pt:PurchaseOrder/
jdf:JDF/pt:ResourcePool/pt:Contact[@ContactTypes='Shipping']/pt:Person/
@FirstName"/>
</firstname>
<lastname>
<xsl:value-of select="pt:PrintTalk/pt:Request/pt:PurchaseOrder/
jdf:JDF/pt:ResourcePool/pt:Contact[@ContactTypes='Shipping']/pt:Person/
@FamilyName"/>
</lastname>
<address1>
<xsl:value-of select="pt:PrintTalk/pt:Request/pt:PurchaseOrder/
jdf:JDF/pt:ResourcePool/pt:Contact[@ContactTypes='Shipping']/
pt:Address/@Street"/>
</address1>
<address2>
<xsl:value-of select="pt:PrintTalk/pt:Request/pt:PurchaseOrder/
jdf:JDF/pt:ResourcePool/pt:Contact[@ContactTypes='Shipping']/
pt:Address/@ExtendedAddress"/>
</address2>
<address3> </address3>
<city>
<xsl:value-of select="pt:PrintTalk/pt:Request/pt:PurchaseOrder/
jdf:JDF/pt:ResourcePool/pt:Contact[@ContactTypes='Shipping']/
pt:Address/@City"/>
</city>
<state>
<xsl:value-of select="pt:PrintTalk/pt:Request/pt:PurchaseOrder/
jdf:JDF/pt:ResourcePool/pt:Contact[@ContactTypes='Shipping']/
pt:Address/@Region"/>
</state>
<postalcode>
<xsl:value-of select="pt:PrintTalk/pt:Request/pt:PurchaseOrder/
jdf:JDF/pt:ResourcePool/pt:Contact[@ContactTypes='Shipping']/
pt:Address/@PostalCode"/>
</postalcode>
<xsl:choose>
<xsl:when test="string-length(pt:PrintTalk/pt:Request/
pt:PurchaseOrder/jdf:JDF/pt:ResourcePool/pt:Contact
[@ContactTypes='Shipping']/pt:Address/@CountryCode)>0">
<country>
<xsl:value-of select="pt:PrintTalk/pt:Request/pt:PurchaseOrder/
jdf:JDF/pt:ResourcePool/pt:Contact[@ContactTypes='Shipping']/
pt:Address/@CountryCode"/>
</country>
</xsl:when>
<xsl:otherwise>
<country>US</country>
</xsl:otherwise>
</xsl:choose>
<phone>
<xsl:value-of select="pt:PrintTalk/pt:Request/pt:PurchaseOrder/
jdf:JDF/pt:ResourcePool/pt:Contact[@ContactTypes='Shipping']/pt:Person/
pt:ComChannel/@Locator"/>
</phone>
<email/>
</xsl:element>
</Order>
</xsl:template>
</xsl:stylesheet>
output:
<?xml version="1.0" encoding="UTF-8"?>
<Order orderDate="2007-03-02T08:16:00-08:00" OrderID="XYZ-STR-350047"
CustomerID="Xyz" xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
xmlns:jdf="http://www.CIP4.org/JDFSchema_1_1">
<Address AddressID="1">
<firstname>Jane Doe</firstname>
<lastname />
<address1>156 Abby Ave</address1>
<address2>Apt204</address2>
<address3 />
<city>Northpole</city>
<state>AK</state>
<postalcode>99548</postalcode>
<country>US</country>
<phone>5555551212</phone>
<email />
</Address>
</Order>
~Gina_M~
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
