This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Xpath newbie question


Forgive me for allowing myself the luxury of asking what is probably a
basic question, when perhaps I should be digging into the
documentation to find the answer.

I am unable to match all the xml data that I need to match in a single
XSL instance.  

Relevant section of XML:

<as2:envelope xmlns:as2="http://www.uc-council.org/smp/schemas/as2"; xmlns:fmcg="http://www.uc-council.org/smp/schemas/fmcg"; xmlns:simpl-eb="http://www.uc-council.org/smp/schemas/simpl-eb"; xmlns:msg="http://www.uc-council.org/smp/schemas/msg"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.uc-council.org/smp/schemas/as2 Envelope.xsd" communicationVersion="1.0">
	<msg:body>
		<transaction>
			<entityIdentification>
				<uniqueCreatorIdentification>_1_uniqueCreatorIdentification_</uniqueCreatorIdentification>
				<contentOwner>
					<gln>4134_gln_7002</gln>
				</contentOwner>
			</entityIdentification>
			<command>
				<documentCommand>
					<documentCommandHeader type="ADD">
						<entityIdentification>
							<uniqueCreatorIdentification>_2_uniqueCreatorIdentification_</uniqueCreatorIdentification>
							<contentOwner>
								<gln>41344_gln_002</gln>
							</contentOwner>
						</entityIdentification>
					</documentCommandHeader>
					<documentCommandOperand>
						<fmcg:item creationDate="2001-06-28T12:13:14" documentStatus="ORIGINAL" contentVersion="1.0" documentStructureVersion="1.0" lastUpdateDate="2001-06-28">
							<fmcg:itemInformation>
								<paymentTerms type="BASIC_(NET)" eventType="ANTICIPATED_DELIVERY_DATE">
									<proximoCutOffDay>23</proximoCutOffDay>
									<discountPayment discountType="Preferential">
										<discountDescription>
											<description language="EN">
												<text>Preferential Customers</text>
											</description>
										</discountDescription>
										<date>2001-06-28</date>
									</discountPayment>
									<installmentDue>
										<percentageOfPaymentDue>12</percentageOfPaymentDue>
										<timePeriodDue type="DAYS">8</timePeriodDue>
									</installmentDue>
									<netPayment>
										<dayOfMonthDue>23</dayOfMonthDue>
									</netPayment>
								</paymentTerms>
								<allowanceCharge type="ALLOWANCE_GLOBAL" allowanceOrChargeType="ALLOWANCE" effectiveDateType="EFFECTIVE_DATE" sequenceNumber="1" settlementType="BILL_BACK">
									<priceBracketList>
										<bracketIdentifier>
<snip>

Here is the XSL with the "Discount" Template at the top of the file.

 
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version='1.0' xmlns:fo="http://www.w3.org/1999/XSL/Format";  xmlns:fmcg="http://www.uc-council.org/smp/schemas/fmcg"; >


<!-- Discount Rule now at the top --> 
<xsl:template match="//fmcg:itemInformation/paymentTerms/discountPayment/discountDescription/description/text">
<fo:block>
Discount: <xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="//command/documentCommand/*/entityIdentification">
  <fo:block>Document Produced by: <xsl:value-of select="uniqueCreatorIdentification"/> </fo:block>
</xsl:template>

<xsl:template match="//fmcg:itemInformation/paymentTerms">
  <fo:block>
    Payment Terms: <xsl:value-of select="@type"/> based on  <xsl:value-of select="proximoCutOffDay"/> days from <xsl:value-of select="@eventType"/>
  </fo:block>
</xsl:template>

<xsl:template match="//installmentDue">
  <fo:block>
  Percentage of Payment due: <xsl:apply-templates select="percentageOfPaymentDue"/>
  </fo:block>
</xsl:template>

<!-- alternatively Discount Rule could be here -->
</xsl:stylesheet>  


The result of the XSL above is:

<?xml version="1.0" encoding="UTF-8"?>
				_1_uniqueCreatorIdentification_
					4134_gln_7002
						<fo:block xmlns:fmcg="http://www.uc-council.org/smp/schemas/fmcg"; xmlns:fo="http://www.w3.org/1999/XSL/Format";>Document Produced by: _2_uniqueCreatorIdentification_</fo:block>
									23
												<fo:block xmlns:fmcg="http://www.uc-council.org/smp/schemas/fmcg"; xmlns:fo="http://www.w3.org/1999/XSL/Format";>
Discount: Preferential Customers</fo:block>
										2001-06-28
										12
										8

<snip>

However if the Discount Rule is at the bottom (or even deleted), then the
output ibecomes:

<?xml version="1.0" encoding="UTF-8"?>
				_1_uniqueCreatorIdentification_
					4134_gln_7002
						<fo:block xmlns:fmcg="http://www.uc-council.org/smp/schemas/fmcg"; xmlns:fo="http://www.w3.org/1999/XSL/Format";>Document Produced by: _2_uniqueCreatorIdentification_</fo:block>
								<fo:block xmlns:fmcg="http://www.uc-council.org/smp/schemas/fmcg"; xmlns:fo="http://www.w3.org/1999/XSL/Format";>
    Payment Terms: BASIC_(NET) based on  23 days from ANTICIPATED_DELIVERY_DATE</fo:block>
											The entity ID here
										1234
										123.12
										24
										4
										98
<snip>


So with the "Discount"  template at the bottom, it has no effect and with it at
the top it works fine but prevents the "Payment Terms" template from
having any effect.

How do I have all Templates matching at the same time?

Thank you
---
Eric Smith

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]