actually i want to add <a> tag with value inside 1,2,3,4 and so on depending on the post
i am using <b:loop> for this .
this is my code
<div class='queno'>
<b:loop index='i' values='["1","2","3","4","5","6"]' var='foo'>
<a expr:href='"#" + (data:i + 1)' expr:id='"a" + (data:i + 1)'><data:foo/></a>
</b:loop>
so how can print from 1 to n inside the a tag in blogger
When attempting to import XML data using an SSIS package, I keep getting this error :
The XML Source was unable to process the XML data. The Xml source document contains multiple "CaseCode" elements and maxOccurs=1 was specified in the Xml schema.
I'm using the following sample data:
<?xml version="1.0" encoding="UTF-8"?>
<Cases>
<Case>
<CaseCode>6789</CaseCode>
<EthicsPoint_CaseID>0</EthicsPoint_CaseID>
<TierName>Legacy</TierName>
<ReportNumber>Sample-2018-1-5</ReportNumber>
<PrimaryIssueType>Inquiry</PrimaryIssueType>
<CaseStatus>Unreviewed</CaseStatus>
<AlertStatus></AlertStatus>
<OrgName></OrgName>
<LocationAddress></LocationAddress>
<LocationCity></LocationCity>
<LocationState></LocationState>
<LocationPostalCode></LocationPostalCode>
<LocationCountry></LocationCountry>
<Details>Question about the policy on attire.</Details>
<CaseCreator>Caelum, Noctis Lucis</CaseCreator>
<PrimaryOutcome>- Select One -</PrimaryOutcome>
<Secondary1Outcome>- Select One -</Secondary1Outcome>
<Secondary2Outcome>- Select One -</Secondary2Outcome>
<ActionTaken>- Select One -</ActionTaken>
<DateOpened>2017-10-15T00:00:00</DateOpened>
<DateUpdated>2018-01-11T12:59:24</DateUpdated>
<Language>English</Language>
<IsReporterEmployee></IsReporterEmployee>
<IntakeMethod>Phone</IntakeMethod>
<ReporterAnonymous>Yes</ReporterAnonymous>
<ReporterFirstName></ReporterFirstName>
<ReporterLastName></ReporterLastName>
<ReporterPhone></ReporterPhone>
<ReporterEmail></ReporterEmail>
<Edited>0</Edited>
<HasOriginal>0</HasOriginal>
<CaseType>Inquiry</CaseType>
<IsViolation>No</IsViolation>
<CaseConfidential>0</CaseConfidential>
<Summary></Summary>
<PolicyAffected>0</PolicyAffected>
<ControlFailure>0</ControlFailure>
<Secondary1IssueType></Secondary1IssueType>
<Secondary2IssueType></Secondary2IssueType>
<PolicyViolation>0</PolicyViolation>
<ComplianceViolationType>0</ComplianceViolationType>
<DataPrivacy>No</DataPrivacy>
<ReporterParticipantCode>0</ReporterParticipantCode>
<TotalItemLoss>0.000000000000000e+000</TotalItemLoss>
<TotalItemDamage>0.000000000000000e+000</TotalItemDamage>
<DataPrivacyReason>0</DataPrivacyReason>
<AssigneeOnly>0</AssigneeOnly>
<LocationName></LocationName>
<BranchNumber></BranchNumber>
<IsHotline>No</IsHotline>
<Participant>
<CaseCode>6789</CaseCode>
<ParticipantCode>6910</ParticipantCode>
<FirstName>Mary</FirstName>
<MiddleName/>
<LastName>Tudor</LastName>
<PhoneNumber/>
<Email/>
<HRCode/>
<Badge/>
<Relationship>Employee</Relationship>
<Role>Reporter</Role>
<PrimaryParticipantResult>No Action Necessary</PrimaryParticipantResult>
<Secondary1ParticipantResult>No Action Necessary</Secondary1ParticipantResult>
<Secondary2ParticipantResult>No Action Necessary</Secondary2ParticipantResult>
</Participant>
<CaseHistory>
<CaseCode>6789</CaseCode>
<TrackTypeName>Added File</TrackTypeName>
<TrackUpdatedDate>2018-01-11T12:58:56.063</TrackUpdatedDate>
<TrackAnonymous>0</TrackAnonymous>
<TrackComment>fluffy-bunny.jpeg</TrackComment>
<Guest>0</Guest>
<TrackSourceName>User</TrackSourceName>
<UserName>Caelum, Noctis Lucis</UserName>
</CaseHistory>
<CaseHistory>
<CaseCode>6789</CaseCode>
<TrackTypeName>Added File</TrackTypeName>
<TrackUpdatedDate>2018-01-11T12:59:01.160</TrackUpdatedDate>
<TrackAnonymous>0</TrackAnonymous>
<TrackComment>Huge Fluffy Dog.jpg</TrackComment>
<Guest>0</Guest>
<TrackSourceName>User</TrackSourceName>
<UserName>Caelum, Noctis Lucis</UserName>
</CaseHistory>
<CaseHistory>
<CaseCode>6789</CaseCode>
<TrackTypeName>Added File</TrackTypeName>
<TrackUpdatedDate>2018-01-11T12:59:06.233</TrackUpdatedDate>
<TrackAnonymous>0</TrackAnonymous>
<TrackComment>Test file.docx</TrackComment>
<Guest>0</Guest>
<TrackSourceName>User</TrackSourceName>
<UserName>Caelum, Noctis Lucis</UserName>
</CaseHistory>
<CaseHistory>
<CaseCode>6789</CaseCode>
<TrackTypeName>Added File</TrackTypeName>
<TrackUpdatedDate>2018-01-11T12:59:11.427</TrackUpdatedDate>
<TrackAnonymous>0</TrackAnonymous>
<TrackComment>The Raven.pdf</TrackComment>
<Guest>0</Guest>
<TrackSourceName>User</TrackSourceName>
<UserName>Caelum, Noctis Lucis</UserName>
</CaseHistory>
<CaseHistory>
<CaseCode>6789</CaseCode>
<TrackTypeName>Viewed Case</TrackTypeName>
<TrackUpdatedDate>2018-01-11T13:20:20.317</TrackUpdatedDate>
<TrackAnonymous>0</TrackAnonymous>
<TrackComment/>
<Guest>0</Guest>
<TrackSourceName>User</TrackSourceName>
<UserName>Caelum, Noctis Lucis</UserName>
</CaseHistory>
<CaseHistory>
<CaseCode>6789</CaseCode>
<TrackTypeName>Viewed Case</TrackTypeName>
<TrackUpdatedDate>2018-01-18T10:06:06.610</TrackUpdatedDate>
<TrackAnonymous>0</TrackAnonymous>
<TrackComment/>
<Guest>0</Guest>
<TrackSourceName>User</TrackSourceName>
<UserName>Smith, Jane</UserName>
</CaseHistory>
<CaseHistory>
<CaseCode>6789</CaseCode>
<TrackTypeName>Viewed Case</TrackTypeName>
<TrackUpdatedDate>2018-02-23T13:26:19.373</TrackUpdatedDate>
<TrackAnonymous>0</TrackAnonymous>
<TrackComment/>
<Guest>0</Guest>
<TrackSourceName>User</TrackSourceName>
<UserName>Specialist, Technical</UserName>
</CaseHistory>
<AccessBlacklist>
<CaseCode>6789</CaseCode>
<UserName>Bennett, Eliza</UserName>
<BlacklistDate>2018-01-11T12:59:24</BlacklistDate>
</AccessBlacklist>
<AccessBlacklist>
<CaseCode>6789</CaseCode>
<UserName>Lionheart, Squall</UserName>
<BlacklistDate>2018-01-11T12:59:24</BlacklistDate>
</AccessBlacklist>
<Attachments>
<CaseCode>6789</CaseCode>
<FileCode>170</FileCode>
<RestitutionCode>0</RestitutionCode>
<FileType>image/jpeg</FileType>
<DateUploaded>2018-01-11T12:58:56.040</DateUploaded>
<Key/>
<FileName>170-fluffy-bunny.jpeg</FileName>
<Size>19870</Size>
<FileCategoryCode>Other</FileCategoryCode>
<Original_Description/>
<TranslationNeeded_Description>0</TranslationNeeded_Description>
<EthicsPoint_CaseFileCode>0</EthicsPoint_CaseFileCode>
<FileURL/>
<ReporterFile>0</ReporterFile>
</Attachments>
<Attachments>
<CaseCode>6789</CaseCode>
<FileCode>171</FileCode>
<RestitutionCode>0</RestitutionCode>
<FileType>image/jpeg</FileType>
<DateUploaded>2018-01-11T12:59:01.123</DateUploaded>
<Key/>
<FileName>171-Huge Fluffy Dog.jpg</FileName>
<Size>70808</Size>
<FileCategoryCode>Other</FileCategoryCode>
<Original_Description/>
<TranslationNeeded_Description>0</TranslationNeeded_Description>
<EthicsPoint_CaseFileCode>0</EthicsPoint_CaseFileCode>
<FileURL/>
<ReporterFile>0</ReporterFile>
</Attachments>
<Attachments>
<CaseCode>6789</CaseCode>
<FileCode>172</FileCode>
<RestitutionCode>0</RestitutionCode>
<FileType>application/vnd.openxmlformats-officedocument.wordprocessingml.document</FileType>
<DateUploaded>2018-01-11T12:59:06.213</DateUploaded>
<Key/>
<FileName>172-Test file.docx</FileName>
<Size>12628</Size>
<FileCategoryCode>Other</FileCategoryCode>
<Original_Description/>
<TranslationNeeded_Description>0</TranslationNeeded_Description>
<EthicsPoint_CaseFileCode>0</EthicsPoint_CaseFileCode>
<FileURL/>
<ReporterFile>0</ReporterFile>
</Attachments>
<Attachments>
<CaseCode>6789</CaseCode>
<FileCode>173</FileCode>
<RestitutionCode>0</RestitutionCode>
<FileType>application/pdf</FileType>
<DateUploaded>2018-01-11T12:59:11.297</DateUploaded>
<Key/>
<FileName>173-The Raven.pdf</FileName>
<Size>446126</Size>
<FileCategoryCode>Other</FileCategoryCode>
<Original_Description/>
<TranslationNeeded_Description>0</TranslationNeeded_Description>
<EthicsPoint_CaseFileCode>0</EthicsPoint_CaseFileCode>
<FileURL/>
<ReporterFile>0</ReporterFile>
</Attachments>
<CustomFields>
<CaseCode>6789</CaseCode>
<CustomFieldName>Interpreter Used</CustomFieldName>
<CustomFieldValue>No</CustomFieldValue>
<DisplaySection>Case</DisplaySection>
<FieldType>Dropdown</FieldType>
</CustomFields>
</Case>
</Cases>
I'm using the following XSD:
PasteBin
As far as I can tell there are no multiple CaseCodes inside a Case. I'm confused, don't work with XML much, any help or pointers are much appriciated.
I tried to validate the XML against the XSD.
The validation revealed few errors.
You need to make a decision about what is correct XML or XSD.
[Error] Canolyb1.xml:6:13: cvc-complex-type.2.4.a: Invalid content was found starting with element 'TierName'. One of '{EPRSNo}' is expected.
[Error] Canolyb1.xml:57:15: cvc-complex-type.2.4.a: Invalid content was found starting with element 'FirstName'. One of '{NamePrefix}' is expected.
[Error] Canolyb1.xml:153:21: cvc-complex-type.2.4.a: Invalid content was found starting with element 'RestitutionCode'. One of '{DataCode}' is expected.
[Error] Canolyb1.xml:169:21: cvc-complex-type.2.4.a: Invalid content was found starting with element 'RestitutionCode'. One of '{DataCode}' is expected.
[Error] Canolyb1.xml:185:21: cvc-complex-type.2.4.a: Invalid content was found starting with element 'RestitutionCode'. One of '{DataCode}' is expected.
[Error] Canolyb1.xml:201:21: cvc-complex-type.2.4.a: Invalid content was found starting with element 'RestitutionCode'. One of '{DataCode}' is expected.
I'm running a SOLR with a set of OSM Addresses.
On the other hand I have some polygons in the same collection.
I got the JTS in my solr, everything is working fine.
My problem: For example the user is searching for a specific address like this:
/solr/select?q=Bruhweg&wt=json
The result will look like something like this:
"type":["Feature"],
"wkt":["POLYGON((9.0650999 48.80407349974092,9.065108 48.80405349974092,9.0651604 48.804044599740934,9.0651758 48.80405819974092,9.0652663 48.804044699740935,9.0652795 48.804077499740934,9.065298 48.804074799740924,9.06531 48.80411229974091,9.0653315 48.80411249974092,9.0653495 48.804152299740906,9.0653595 48.804185299740894,9.065227 48.8042043997409,9.0652154 48.804206599740894,9.0652046 48.80417829974089,9.0651805 48.8041809997409,9.065163500000002 48.8041373997409,9.0651464 48.8041391997409,9.0651335 48.80409639974092,9.0651051 48.80409789974092,9.0650999 48.80407349974092))"],
"properties.label":"Bruhweg 11"
"properties.category":"address"
where the field "wkt" is matched to the correct SOLR Type, which we can simply verify with the following request:
solr/select?fq=wkt%3A%22Intersects(9.0650999%2048.80407349974092)%22&q=&wt=json*
Notice that I have just taken the first coordinate from "Bruhweg 11" polygon. The result looks like this:
"type":["Feature"],
"wkt":["POLYGON((9.0650999 48.80407349974092,9.065108 48.80405349974092,9.0651604 48.804044599740934,9.0651758 48.80405819974092,9.0652663 48.804044699740935,9.0652795 48.804077499740934,9.065298 48.804074799740924,9.06531 48.80411229974091,9.0653315 48.80411249974092,9.0653495 48.804152299740906,9.0653595 48.804185299740894,9.065227 48.8042043997409,9.0652154 48.804206599740894,9.0652046 48.80417829974089,9.0651805 48.8041809997409,9.065163500000002 48.8041373997409,9.0651464 48.8041391997409,9.0651335 48.80409639974092,9.0651051 48.80409789974092,9.0650999 48.80407349974092))"],
"properties.label":"Bruhweg 11"
"properties.category":"address"
"type":["Feature"],
"wkt":["POLYGON((9.04226364394244 48.78375351560371,9.056374594613018 48.78376897799828,9.059599869694331 48.78163342420202,9.081809522348271 48.78162969553386,9.081761686040636 48.78226547394644,9.082034238895682 48.78253237030596,9.0856383112481 48.783065728036505,9.081013408886774 48.784895520573016,9.08026549061692 48.78523860978792,9.075279465525824 48.78709720944531,9.075385415333642 48.78784623302399,9.075233988916805 48.78855044494239,9.07538936442188 48.789573632543714,9.076086792392704 48.7899895067132,9.076400978454831 48.79076807795856,9.076954863544922 48.791675940101136,9.077323565779931 48.79247426327167,9.077661454940172 48.79359088232947,9.07820886975919 48.79468135994337,9.078817709274189 48.79498392847467,9.079201898938019 48.79520667445914,9.08016333903955 48.79554857516962,9.079778914425672 48.79518198750416,9.079578091974522 48.79467583486249,9.07960878146339 48.79427927263826,9.079777474351143 48.794273758443296,9.079890211573053 48.79495800149708,9.08018722352202 48.795156515552904,9.080499405509059 48.795473674672415,9.080691862967708 48.795850379952874,9.080924981851217 48.79602374816294,9.081213923069749 48.79636161227024,9.08216503129647 48.797025378100585,9.082445049467385 48.796812064430696,9.082997510785853 48.79666782293686,9.083016532890815 48.798210792078066,9.084546369553149 48.79818997904426,9.08436196313672 48.79857684935421,9.084539100024378 48.798725962114545,9.084861025057869 48.79994602380419,9.084990671623789 48.80091802856458,9.08494424868377 48.80165186074672,9.085041682576207 48.80209339903589,9.08538756537159 48.802966378021715,9.086053469766966 48.80390370812341,9.085797560540206 48.803894003364,9.085814723600494 48.80437509265621,9.085407910580006 48.80612600144947,9.086188011009677 48.80771257109675,9.087281863093846 48.80971073096298,9.086304168618957 48.809607114458665,9.08560710806074 48.80961663014216,9.084061519923088 48.80938486330555,9.084077207035987 48.80980658042419,9.083543243778244 48.811250273222925,9.056400173581295 48.81120764569635,9.055584833918676 48.81131770190693,9.05233070753251 48.81010351728196,9.050449180583943 48.81143341235964,9.047719936766072 48.81048226708057,9.047480579846537 48.81086460229471,9.04435778697807 48.809744505510096,9.042626974936422 48.809303638995836,9.038908229735283 48.80850647660382,9.037144908448282 48.808184194812405,9.038129032787538 48.805980772861595,9.038328485640509 48.8051777307488,9.03824791543268 48.80471104904327,9.03876113924191 48.80479984728909,9.03889592317821 48.802984244443905,9.037701980314722 48.802949557020376,9.036369132836748 48.80272688628704,9.035368430087201 48.802290085608014,9.035368259304592 48.8020471956323,9.033685064639178 48.801228620567926,9.032644752493526 48.800737922085965,9.03217057774127 48.8000889091118,9.032098034258505 48.799508062093246,9.031417252535123 48.79921048432656,9.031802215987176 48.798784151506815,9.031441019924467 48.798238377399365,9.03225196905176 48.797687782137466,9.033547957749326 48.79595641436032,9.038695453795164 48.79394510865497,9.03934415364024 48.7933001500083,9.041676969957162 48.7917058788909,9.043068750531523 48.789672193708604,9.043444520390391 48.788257529857816,9.043555307907576 48.787275490180576,9.042249027750703 48.785802079685375,9.042512195810728 48.784854079302804,9.042199907427747 48.7840458175582,9.04226364394244 48.78375351560371))"],
"properties.label":"polygonA",
"properties.category":"polygons"
What I want:
If the user is just searching for Bruhweg I want as result the address AND the polygonA from category polygons
Any Idea how to solve this?
I need to loop though this SAP IDOC to report shipment data. I need to break at each change of E2EDT37_KDMAT (part number), E2EDT37_VHILM_KU (package type) and E2EDT37_QUANTITY in the G07 node (PACKAGE). The current code seemed to work until there was more than one G16 (DELIVERY) node within a G01 (SHIPMENT) node.
This snippet of code doesn't produce XML output and the issue is seen in the message output.
I believe the method I am trying is just not valid and I will find another way. But I don't understand why exactly. I've tried preceding-sibling instead of preceding and just got different wrong output.
Each loop uses the same predicate as the last with one more criterion added to identify all matching the E2EDT37 records and perform the next statement once for each unique value of E2EDT37_KDMAT, E2EDT37_VHILM_KU and lastly E2EDT37_QUANTITY. It seems to come so close but never gets it right. What is my misunderstanding of the way E2EDT37_KDMAT[not(.=preceding::E2EDT37_KDMAT)] works here?
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.1" xmlns:exsl="http://exslt.org/common"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:XmlTransform="java:de.axway.converter.xml.xsltextensions.XsltExtensions" exclude-result-prefixes="XmlTransform xsl exsl">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="/ACTIS">
<xsl:message></xsl:message>
<xsl:call-template name="DESADV_D96A"/>
</xsl:template>
<xsl:template name="DESADV_D96A">
<xsl:for-each select="//G16">
<xsl:variable name="current-delivery" select="E2EDL20/E2EDL20_VBELN "/>
<xsl:choose>
<xsl:when test="/ACTIS/G01/G07[#PACK_TYPE='OUTER']/E2EDT37[contains(E2EDT37_DELIVERIES, $current-delivery)]">
<xsl:call-template name="Create_Outer_PAC">
<xsl:with-param name="current-delivery" select=" $current-delivery "/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template name="Create_Outer_PAC">
<xsl:param name="current-delivery"/>
<xsl:message>In Create_Outer_PACK Delivery: <xsl:value-of select="$current-delivery"/></xsl:message>
<xsl:for-each select="/ACTIS/G01/G07/E2EDT37[E2EDT37_PACK_TYPE='OUTER'][contains(E2EDT37_DELIVERIES, $current-delivery)]">
<xsl:variable name="Pallet" select="current()"/>
<xsl:message>For each Outer_PAC : <xsl:value-of select="$Pallet/E2EDT37_EXIDV"/></xsl:message>
<xsl:for-each select="/ACTIS/G01/G07/E2EDT37[E2EDT37_PACK_TYPE='INNER'][E2EDT37_PARENT=$Pallet/E2EDT37_EXIDV][E2EDT37_DELIVERY=$current-delivery]/E2EDT37_KDMAT[not(.=preceding::E2EDT37_KDMAT)]">
<xsl:variable name="current-part" select="current()"/>
<xsl:message>For each E2EDT37_KDMAT : <xsl:value-of select="$current-part"/></xsl:message>
<xsl:message select="/ACTIS/G01/G07/E2EDT37[E2EDT37_PACK_TYPE='INNER'][E2EDT37_PARENT=$Pallet/E2EDT37_EXIDV][E2EDT37_DELIVERY=$current-delivery][E2EDT37_KDMAT=$current-part]/E2EDT37_VHILM_KU"/>
<xsl:for-each select="/ACTIS/G01/G07/E2EDT37[E2EDT37_PACK_TYPE='INNER'][E2EDT37_PARENT=$Pallet/E2EDT37_EXIDV][E2EDT37_DELIVERY=$current-delivery][E2EDT37_KDMAT=$current-part]/E2EDT37_VHILM_KU[not(.=preceding::E2EDT37_VHILM_KU)]">
<xsl:variable name="current-vhilm_ku" select="current()"/>
<xsl:message>For each E2EDT37_VHILM_KU: <xsl:value-of select="$current-vhilm_ku"/></xsl:message>
<xsl:for-each select="/ACTIS/G01/G07/E2EDT37[E2EDT37_PACK_TYPE='INNER'][E2EDT37_PARENT=$Pallet/E2EDT37_EXIDV][E2EDT37_DELIVERY=$current-delivery][E2EDT37_KDMAT=$current-part][E2EDT37_VHILM_KU=$current-vhilm_ku]/E2EDT37_QUANTITY[not(.=preceding::E2EDT37_QUANTITY)]">
<xsl:variable name="current-packqty" select="current()"/>
<xsl:message></xsl:message>
<xsl:message>For each E2EDT37_QUANTITY: <xsl:value-of select="$current-packqty"/></xsl:message>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Data
<?xml version="1.0" encoding="UTF-8"?>
<ACTIS>
<EDI_DC>
<EDI_DC_TABNAM>EDI_DC40</EDI_DC_TABNAM>
<EDI_DC_CREDAT>20190702</EDI_DC_CREDAT>
<EDI_DC_CRETIM>210325</EDI_DC_CRETIM>
<EDI_DC_SERIAL>20190702210323</EDI_DC_SERIAL>
</EDI_DC>
<G01>
<E2EDT20>
<E2EDT20_SEGNAM>E2EDT20002</E2EDT20_SEGNAM>
<E2EDT20_MANDT>100</E2EDT20_MANDT>
<E2EDT20_DOCNUM>0000004250699555</E2EDT20_DOCNUM>
<E2EDT20_SEGNUM>000001</E2EDT20_SEGNUM>
<E2EDT20_PSGNUM>000000</E2EDT20_PSGNUM>
<E2EDT20_HLEVEL>01</E2EDT20_HLEVEL>
<E2EDT20_TKNUM>0049409223</E2EDT20_TKNUM>
</E2EDT20>
<G07 PACK_TYPE="INNER" PARENT="505059227" CHILDREN="0" MIXED="0">
<E2EDT37 PACK_TYPE="INNER" PARENT="505059227" CHILDREN="0" MIXED="0">
<E2EDT37_SEGNAM>E2EDT37006</E2EDT37_SEGNAM>
<E2EDT37_MANDT>100</E2EDT37_MANDT>
<E2EDT37_DOCNUM>0000004250699555</E2EDT37_DOCNUM>
<E2EDT37_SEGNUM>000044</E2EDT37_SEGNUM>
<E2EDT37_PSGNUM>000001</E2EDT37_PSGNUM>
<E2EDT37_HLEVEL>02</E2EDT37_HLEVEL>
<E2EDT37_EXIDV>00000000000505755236</E2EDT37_EXIDV>
<E2EDT37_VHILM_KU>0000SON</E2EDT37_VHILM_KU>
<E2EDT37_PACK_TYPE>INNER</E2EDT37_PACK_TYPE>
<E2EDT37_CHILDREN>0</E2EDT37_CHILDREN>
<E2EDT37_PARENT>505059227</E2EDT37_PARENT>
<E2EDT37_DELIVERY>0037371519</E2EDT37_DELIVERY>
<E2EDT37_DELIVERY_POSITION>000010</E2EDT37_DELIVERY_POSITION>
<E2EDT37_QUANTITY>8500.000</E2EDT37_QUANTITY>
<E2EDT37_UOM>PCE</E2EDT37_UOM>
<E2EDT37_KDMAT>6561111</E2EDT37_KDMAT>
<E2EDT37_VBRST>1000</E2EDT37_VBRST>
</E2EDT37>
</G07>
<G07 PACK_TYPE="INNER" PARENT="505059227" CHILDREN="0" MIXED="0">
<E2EDT37 PACK_TYPE="INNER" PARENT="505059227" CHILDREN="0" MIXED="0">
<E2EDT37_SEGNAM>E2EDT37006</E2EDT37_SEGNAM>
<E2EDT37_MANDT>100</E2EDT37_MANDT>
<E2EDT37_DOCNUM>0000004250699555</E2EDT37_DOCNUM>
<E2EDT37_SEGNUM>000047</E2EDT37_SEGNUM>
<E2EDT37_PSGNUM>000001</E2EDT37_PSGNUM>
<E2EDT37_HLEVEL>02</E2EDT37_HLEVEL>
<E2EDT37_EXIDV>00000000000505755237</E2EDT37_EXIDV>
<E2EDT37_VHILM_KU>0000SON</E2EDT37_VHILM_KU>
<E2EDT37_PACK_TYPE>INNER</E2EDT37_PACK_TYPE>
<E2EDT37_CHILDREN>0</E2EDT37_CHILDREN>
<E2EDT37_PARENT>505059227</E2EDT37_PARENT>
<E2EDT37_DELIVERY>0037371484</E2EDT37_DELIVERY>
<E2EDT37_DELIVERY_POSITION>000010</E2EDT37_DELIVERY_POSITION>
<E2EDT37_QUANTITY>7000.000</E2EDT37_QUANTITY>
<E2EDT37_UOM>PCE</E2EDT37_UOM>
<E2EDT37_KDMAT>6561143</E2EDT37_KDMAT>
<E2EDT37_VBRST>1000</E2EDT37_VBRST>
</E2EDT37>
</G07>
<G07 PACK_TYPE="OUTER" CHILDREN="2" MIXED="1">
<E2EDT37 PACK_TYPE="OUTER" CHILDREN="2" MIXED="1">
<E2EDT37_SEGNAM>E2EDT37006</E2EDT37_SEGNAM>
<E2EDT37_MANDT>100</E2EDT37_MANDT>
<E2EDT37_DOCNUM>0000004250699555</E2EDT37_DOCNUM>
<E2EDT37_SEGNUM>000050</E2EDT37_SEGNUM>
<E2EDT37_PSGNUM>000001</E2EDT37_PSGNUM>
<E2EDT37_HLEVEL>02</E2EDT37_HLEVEL>
<E2EDT37_EXIDV>505059227</E2EDT37_EXIDV>
<E2EDT37_VHILM_KU>0000SON</E2EDT37_VHILM_KU>
<E2EDT37_CHILDREN>2</E2EDT37_CHILDREN>
<E2EDT37_CONTENTS>00000000000505755236:00000000000505755237:</E2EDT37_CONTENTS>
<E2EDT37_PACK_TYPE>OUTER</E2EDT37_PACK_TYPE>
<E2EDT37_DELIVERIES>0037371519 0037371484</E2EDT37_DELIVERIES>
</E2EDT37>
</G07>
<G16>
<E2EDL20>
<E2EDL20_SEGNAM>E2EDL20004</E2EDL20_SEGNAM>
<E2EDL20_MANDT>100</E2EDL20_MANDT>
<E2EDL20_DOCNUM>0000004250699555</E2EDL20_DOCNUM>
<E2EDL20_SEGNUM>000077</E2EDL20_SEGNUM>
<E2EDL20_PSGNUM>000001</E2EDL20_PSGNUM>
<E2EDL20_HLEVEL>02</E2EDL20_HLEVEL>
<E2EDL20_VBELN>0037371484</E2EDL20_VBELN>
<E2EDL20_VSTEL>0016</E2EDL20_VSTEL>
<E2EDL20_VKORG>0060</E2EDL20_VKORG>
<E2EDL20_VKBUR>EUR</E2EDL20_VKBUR>
<E2EDL20_LGNUM>D16</E2EDL20_LGNUM>
<E2EDL20_ABLAD>JAG01</E2EDL20_ABLAD>
<E2EDL20_INCO1>FCA</E2EDL20_INCO1>
<E2EDL20_INCO2>NÜRNBERG</E2EDL20_INCO2>
<E2EDL20_ROUTE>DES129</E2EDL20_ROUTE>
<E2EDL20_VSBED>ST</E2EDL20_VSBED>
<E2EDL20_BTGEW>107.000</E2EDL20_BTGEW>
<E2EDL20_NTGEW>107.000</E2EDL20_NTGEW>
<E2EDL20_GEWEI>KGM</E2EDL20_GEWEI>
<E2EDL20_VOLUM>1036.427</E2EDL20_VOLUM>
<E2EDL20_VOLEH>DMQ</E2EDL20_VOLEH>
<E2EDL20_ANZPK>00000</E2EDL20_ANZPK>
<E2EDL20_PARID>UNKNOWN</E2EDL20_PARID>
<E2EDL20_PODAT>20190702</E2EDL20_PODAT>
<E2EDL20_POTIM>210324</E2EDL20_POTIM>
</E2EDL20>
<G29>
<E2EDL24>
<E2EDL24_POSNR>000010</E2EDL24_POSNR>
<E2EDL24_KDMAT>6561143</E2EDL24_KDMAT>
<E2EDL24_LFIMG>7000.000</E2EDL24_LFIMG>
<E2EDL24_VRKME>PCE</E2EDL24_VRKME>
<E2EDL24_VBRST>1000</E2EDL24_VBRST>
<E2EDL24_KDMAT35>6561143</E2EDL24_KDMAT35>
<E2EDL24_POSEX>000000</E2EDL24_POSEX>
<E2EDL24_DELIVERY>0037371484</E2EDL24_DELIVERY>
<E2EDL24_PO>5500229851</E2EDL24_PO>
<E2EDL24_PO_DATE>20150612</E2EDL24_PO_DATE>
</E2EDL24>
</G29>
<G29>
<E2EDL24>
<E2EDL24_POSNR>900001</E2EDL24_POSNR>
<E2EDL24_KDMAT>0000SON</E2EDL24_KDMAT>
<E2EDL24_LFIMG>1.000</E2EDL24_LFIMG>
<E2EDL24_VRKME>PCE</E2EDL24_VRKME>
<E2EDL24_VBRST>1000</E2EDL24_VBRST>
<E2EDL24_KDMAT35>0000SON</E2EDL24_KDMAT35>
<E2EDL24_POSEX>000000</E2EDL24_POSEX>
<E2EDL24_DELIVERY>0037371484</E2EDL24_DELIVERY>
</E2EDL24>
</G29>
</G16>
<G16>
<E2EDL20>
<E2EDL20_SEGNAM>E2EDL20004</E2EDL20_SEGNAM>
<E2EDL20_MANDT>100</E2EDL20_MANDT>
<E2EDL20_DOCNUM>0000004250699555</E2EDL20_DOCNUM>
<E2EDL20_SEGNUM>000170</E2EDL20_SEGNUM>
<E2EDL20_PSGNUM>000001</E2EDL20_PSGNUM>
<E2EDL20_HLEVEL>02</E2EDL20_HLEVEL>
<E2EDL20_VBELN>0037371519</E2EDL20_VBELN>
<E2EDL20_VSTEL>0016</E2EDL20_VSTEL>
<E2EDL20_VKORG>0060</E2EDL20_VKORG>
<E2EDL20_VKBUR>EUR</E2EDL20_VKBUR>
<E2EDL20_LGNUM>D16</E2EDL20_LGNUM>
<E2EDL20_ABLAD>JAG01</E2EDL20_ABLAD>
<E2EDL20_INCO1>FCA</E2EDL20_INCO1>
<E2EDL20_INCO2>NÜRNBERG</E2EDL20_INCO2>
<E2EDL20_ROUTE>DES129</E2EDL20_ROUTE>
<E2EDL20_VSBED>ST</E2EDL20_VSBED>
<E2EDL20_BTGEW>140.600</E2EDL20_BTGEW>
<E2EDL20_NTGEW>127.500</E2EDL20_NTGEW>
<E2EDL20_GEWEI>KGM</E2EDL20_GEWEI>
<E2EDL20_VOLUM>42840.000</E2EDL20_VOLUM>
<E2EDL20_VOLEH>CMQ</E2EDL20_VOLEH>
<E2EDL20_ANZPK>00000</E2EDL20_ANZPK>
<E2EDL20_PARID>UNKNOWN</E2EDL20_PARID>
<E2EDL20_PODAT>20190702</E2EDL20_PODAT>
<E2EDL20_POTIM>210325</E2EDL20_POTIM>
</E2EDL20>
<G29>
<E2EDL24>
<E2EDL24_POSNR>000010</E2EDL24_POSNR>
<E2EDL24_KDMAT>6561111</E2EDL24_KDMAT>
<E2EDL24_LFIMG>8500.000</E2EDL24_LFIMG>
<E2EDL24_VRKME>PCE</E2EDL24_VRKME>
<E2EDL24_VBRST>1000</E2EDL24_VBRST>
<E2EDL24_KDMAT35>6561111</E2EDL24_KDMAT35>
<E2EDL24_POSEX>000000</E2EDL24_POSEX>
<E2EDL24_DELIVERY>0037371519</E2EDL24_DELIVERY>
<E2EDL24_PO>5500229848</E2EDL24_PO>
<E2EDL24_PO_DATE>20150612</E2EDL24_PO_DATE>
</E2EDL24>
</G29>
</G16>
</G01>
</ACTIS>
Resulting Output
1) In Create_Outer_PAC Delivery : 0037371484
2) For each Outer_PAC : 505059227
3) For each E2EDT37_KDMAT : 6561143 Good break here at unique KDMAT
I find and display a single matching VHILM_KU here but the next line that tries to loop at each VHILM_KU doesn't occur with the same Xpath as the xsl:message
<xsl:for-each select="/ACTIS/G01/G07/E2EDT37[E2EDT37_PACK_TYPE='INNER'][E2EDT37_PARENT=$Pallet/E2EDT37_EXIDV][E2EDT37_DELIVERY=$current-delivery][E2EDT37_KDMAT=$current-part]/E2EDT37_VHILM_KU[not(.=preceding::E2EDT37_VHILM_KU)]">
<E2EDT37_VHILM_KU>0000SON</E2EDT37_VHILM_KU>
No For each E2EDT37_VHILM_KU break on E2EDT37_VHILM_KU=0000SON
1) In Create_Outer_PAC Delivery : 0037371519
2) For each Outer_PAC : 505059227
3) For each E2EDT37_KDMAT : 6561111
<E2EDT37_VHILM_KU>0000SON</E2EDT37_VHILM_KU>
This one breaks as expected. You see we have an E2EDT37_VHILM_KU found with value 0000SON in the line above here.
I don't reach this message in the first for-each loop above although we also find and display the same E2EDT37_VHILM_KU of 0000SON.
We have two E2EDT37 segments with KDMAT values of 6561143 and 6561141. The first loop breaks at each unique KDMAT as expected.
4) For each E2EDT37_VHILM_KU : 0000SON
5) For each E2EDT37_QUANTITY : 8500.000
Is it valid to check for unique values with /E2EDT37_VHILM_KU[not(.=preceding::E2EDT37_VHILM_KU)] at the same time as limiting the resulting nodes with the predicates [E2EDT37_PACK_TYPE='INNER'][E2EDT37_PARENT=$Pallet/E2EDT37_EXIDV][E2EDT37_DELIVERY=$current-delivery][E2EDT37_KDMAT=$current-part]? I assume that's where I am wrong but the paradigm is not clear to me. The message output shows me the Xpath did find a single VHILM_KU. The next for-each statement with the same Xpath finds nothing.
Is that clearer or more confusing?
I have a directory with several sub-directories in it. Inside there are files. Out of those file1.ext is a duplicate present in more than 1 directory. The sub-directories and filenames are obviously unknown at the time of execution.
-> bigdir
--------> subdir1
----------------> file1.ext
--------> subdir2
----------------> file1.ext
--------> subdir3
----------------> file2.ext
I am trying to copy contents of bigdir into smalldir using flatten="true" so that my resultant file structure looks like
-> smalldir
----------> file1.ext
----------> file2.ext
So far, I have the following
<copy todir="${smalldir}" flatten="true" verbose="true">
<fileset dir="${bigdir}">
<include name="**/*.ext"/>
</fileset>
</copy>
This works fine and achieves the result that I want, HOWEVER, it is an error to have duplicate files in bigdir. I want the build to fail if it detects that bigdir has duplicate filenames inside
I was trying to find a way to make the <copy> task fail in such case. It doesn't have to be through this approach. I can happily run some kind of validation on the directory before copying too, if I could figure out how.
Maybe make each copied file read-only, so that subsequent overwrites as a result of copy flatten=true fail to overwrite and produce an error?
No ant-contrib please
You may use a scriptcondition (see ant manual conditions) with builtin javascript engine
(included since Java 1.6.06, so no extra libraries or ant addons needed), like that :
<project>
<fileset dir="C:\tmp\bigdir" id="whatever"/>
<echo>${toString:whatever}</echo>
<fail message="Duplicate Filenames detected !!">
<condition>
<scriptcondition language="javascript">
<![CDATA[
importPackage(java.util);
var input = project.getProperty('toString:whatever').split(';');
// get basenames
for (var i = 0; i < input.length; i++) {
input[i]=input[i].substring(input[i].lastIndexOf("\\")+1);
}
var inputList = Arrays.asList(input);
// no duplicates in Hashset
var inputSet = new HashSet(inputList);
self.setValue(inputSet.size() < inputList.size());
]]>
</scriptcondition>
</condition>
</fail>
</project>
output :
[echo] subdir1\foo.txt;subdir2\foo.txt;subdir3\foobar.txt
BUILD FAILED
C:\area51\AntTest\tryme.xml:7: Duplicate Filenames detected !!
-- EDIT after comment --
To display the duplicates use something like :
<project>
<fileset dir="C:\bigdir" id="whatever"/>
<echo>${toString:whatever}</echo>
<fail message="Duplicate Filenames detected !!">
<condition>
<scriptcondition language="javascript">
<![CDATA[
importPackage(java.util);
// get DirectoryScanner
ds = whatever.getDirectoryScanner(project);
// get the included files => array
checkFiles = ds.getIncludedFiles();
var checkSet = new HashSet();
var s = "";
for (j=0; j < checkFiles.length; j++) {
f = new java.io.File(whatever.getDir(project), checkFiles[j]);
if(!checkSet.add(f.getName()))
s += f + '\n';
}
println(s.substring(0, s.length - 1));
self.setValue(checkSet.size() < checkFiles.length);
]]>
</scriptcondition>
</condition>
</fail>
</project>
output :
[echo] subdir1\foo.txt;subdir2\foo.txt;subdir3\foobar.txt;subdir3\subsubdir1\foo.txt;subdir3\subsubdir2\foobar.txt;subdir4\foobaz.txt
[fail] C:\bigdir\subdir2\foo.txt
[fail] C:\bigdir\subdir3\subsubdir1\foo.txt
[fail] C:\bigdir\subdir3\subsubdir2\foobar.txt
BUILD FAILED
Btw, often it's much simpler to use the ant api :
// get DirectoryScanner
ds = whatever.getDirectoryScanner(project);
// get the included files => array
checkFiles = ds.getIncludedFiles();
instead of :
var input = project.getProperty('toString:whatever').split(';');
// get basenames
for (var i = 0; i < input.length; i++) {
input[i]=input[i].substring(input[i].lastIndexOf("\\")+1);
}
as i used in first snippet.