Conditional increment in xslt

Conditional increment in xslt

In a Shipment the number of orders is present. For each order there is a number of order line Items. Order Line Items contain item. For each iteration we are maintaining the hierarchy levels. In the orderLine Items section, if the previous item is equal to current item, there is no need to increment hierarchy.

points:

There is only one shipment
Number of orders are present per shipment.
number of orderLineItems per each order.
for each iteration of orders and orderlineItems we have to maintain a hierarchy levels(increment value),but when comes to orderLineItems one condition is there if the previous item is equals to Current item,no need to increment hierarchy level.otherwise we should increment the hierarchy levels like below output we needed.

below is the input.

Input:
<Shipment>
<Shipment1>Shipment151</Shipment1>
<ShipmentValue>ShipmentValue52</ShipmentValue>
<Order>
<Orderlevel1>Orderlevel153</Orderlevel1>
<Orderlevel2>Orderlevel254</Orderlevel2>
<Orderlevel3>Orderlevel355</Orderlevel3>
<OrderLineItems>
<Level1>Level156</Level1>
<Level2>Level257</Level2>
<Level3>Level358</Level3>
<Item>Item59</Item>
</OrderLineItems>
<OrderLineItems>
<Level1>Level160</Level1>
<Level2>Level261</Level2>
<Level3>Level362</Level3>
<Item>Item59</Item>
</OrderLineItems>
<OrderLineItems>
<Level1>Level164</Level1>
<Level2>Level265</Level2>
<Level3>Level366</Level3>
<Item>Item63</Item>
</OrderLineItems>
</Order>
<Order>
<Orderlevel1>Orderlevel168</Orderlevel1>
<Orderlevel2>Orderlevel269</Orderlevel2>
<Orderlevel3>Orderlevel370</Orderlevel3>
<OrderLineItems>
<Level1>Level171</Level1>
<Level2>Level272</Level2>
<Level3>Level373</Level3>
<Item>Item74</Item>
</OrderLineItems>
<OrderLineItems>
<Level1>Level175</Level1>
<Level2>Level276</Level2>
<Level3>Level377</Level3>
<Item>Item78</Item>
</OrderLineItems>
<OrderLineItems>
<Level1>Level179</Level1>
<Level2>Level280</Level2>
<Level3>Level381</Level3>
<Item>Item78</Item>
</OrderLineItems>
</Order>
</Shipment>

below is the output we need.

Output:

<ns1:Shipment>
<ns1:Shipment1>1</ns1:Shipment1>
<ns1:ShipmentValue>S</ns1:ShipmentValue>
<ns1:Order>
<ns1:Orderlevel1>2</ns1:Orderlevel1>
<ns1:Orderlevel2>1</ns1:Orderlevel2>
<ns1:Orderlevel3>O</ns1:Orderlevel3>
<ns1:OrderLineItems>
<ns1:Level1>3</ns1:Level1>
<ns1:Level2>2</ns1:Level2>
<ns1:Level3>I</ns1:Level3>
<ns1:Item>Item59</ns1:Item>
</ns1:OrderLineItems>
<ns1:OrderLineItems>
<ns1:Item>Item59</ns1:Item>
</ns1:OrderLineItems>
<ns1:OrderLineItems>
<ns1:Level1>4</ns1:Level1>
<ns1:Level2>2</ns1:Level2>
<ns1:Level3>I</ns1:Level3>
<ns1:Item>Item63</ns1:Item>
</ns1:OrderLineItems>
</ns1:Order>
<ns1:Order>
<ns1:Orderlevel1>5</ns1:Orderlevel1>
<ns1:Orderlevel2>1</ns1:Orderlevel2>
<ns1:Orderlevel3>O</ns1:Orderlevel3>
<ns1:OrderLineItems>
<ns1:Level1>6</ns1:Level1>
<ns1:Level2>5</ns1:Level2>
<ns1:Level3>I</ns1:Level3>
<Item>Item74</Item>
</ns1:OrderLineItems>
<ns1:OrderLineItems>
<ns1:Level1>7</ns1:Level1>
<ns1:Level2>5</ns1:Level2>
<ns1:Level3>I</ns1:Level3>
<Item>Item78</Item>
</ns1:OrderLineItems> 
<ns1:OrderLineItems>
<ns1:Item>Item78</ns1:Item>
</ns1:OrderLineItems>
</ns1:Order>
</ns1:Shipment>
View Answers

Ads









Related Tutorials/Questions & Answers:
Conditional increment in xslt
Conditional increment in xslt  In a Shipment the number of orders..., there is no need to increment hierarchy. points: There is only one shipment Number... levels(increment value),but when comes to orderLineItems one condition
Conditional increment in xslt
Conditional increment in xslt  In a Shipment the number of orders..., there is no need to increment hierarchy. points: There is only one shipment Number... levels(increment value),but when comes to orderLineItems one condition
Advertisements
Conditional increment in xslt
Conditional increment in xslt  In a Shipment the number of orders..., there is no need to increment hierarchy. points: There is only one shipment Number... levels(increment value),but when comes to orderLineItems one condition
xslt logging
xslt logging  am working with xslt and want to log the user actions like clicking on the button and clicking on the text field etc. Can anyone plss tell me Is that possible..?? Thanks in advance
cONDITIONAL STATEMENT
cONDITIONAL STATEMENT    Write a program that computes and assesses the tuition fee of the students in one trimester, based on the given mode of payment below: Plan (Key) Discount (-) or Interest (+) Cash (1) 10% Discount Two
endif to end the conditional statement.
endif to end the conditional statement.  When are you supposed to use endif to end the conditional statement
conditional statement in java
conditional statement in java  Write a conditional statement in Java... as conditional statements. You can learn "How to write conditional statement in Java " from RoseIndia website. Find the Link below... conditional operators
ModuleNotFoundError: No module named 'conditional'
ModuleNotFoundError: No module named 'conditional'  Hi, My Python... 'conditional' How to remove the ModuleNotFoundError: No module named 'conditional' error? Thanks   Hi, In your python environment
Stumped with NOT NULL AUTO_INCREMENT
to create a new table with the ID column being NOT NULL AUTO_INCREMENT. The table will create if I do not have NOT NULL AUTO_INCREMENT, but it WILL NOT create..._INCREMENT, user_id INT(11), courseid INT(10
Version of fulcrum>fulcrum-xslt dependency
List of Version of fulcrum>fulcrum-xslt dependency
ModuleNotFoundError: No module named 'docx-xslt'
ModuleNotFoundError: No module named 'docx-xslt'  Hi, My Python... 'docx-xslt' How to remove the ModuleNotFoundError: No module named 'docx-xslt' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'tiny_xslt'
ModuleNotFoundError: No module named 'tiny_xslt'  Hi, My Python... 'tiny_xslt' How to remove the ModuleNotFoundError: No module named 'tiny_xslt' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'tiny_xslt'
ModuleNotFoundError: No module named 'tiny_xslt'  Hi, My Python... 'tiny_xslt' How to remove the ModuleNotFoundError: No module named 'tiny_xslt' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'django-xslt'
ModuleNotFoundError: No module named 'django-xslt'  Hi, My Python... 'django-xslt' How to remove the ModuleNotFoundError: No module named 'django-xslt' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'pyramid_xslt'
ModuleNotFoundError: No module named 'pyramid_xslt'  Hi, My Python... 'pyramid_xslt' How to remove the ModuleNotFoundError: No module named 'pyramid_xslt' error? Thanks   Hi, In your python
XSLT Introductions
XSLT Introductions XSLT is an xml based language for transforming XML documents into other XML documents. XSLT stands for eXtensible Styles Language... Transformations (XSLT) and eXtensible Stylesheet Language - Formatting Objects (XSL-FO
turbo c pre-increment question
turbo c pre-increment question  Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print ++a in the same printf() command ten times
MySQL Auto_Increment
MySQL Auto_Increment This example illustrates how to define AUTO_INCREMENT of a field. The AUTO_INCREMENT attribute can be used to generate a unique... AUTO_INCREMENT, name CHAR(30) NOT NULL, PRIMARY KEY (id
ModuleNotFoundError: No module named 'djangocms-conditional'
ModuleNotFoundError: No module named 'djangocms-conditional'  Hi...: No module named 'djangocms-conditional' How to remove the ModuleNotFoundError: No module named 'djangocms-conditional' error? Thanks   Hi
ModuleNotFoundError: No module named 'ec2_tag_conditional'
ModuleNotFoundError: No module named 'ec2_tag_conditional'  Hi, My... named 'ec2_tag_conditional' How to remove the ModuleNotFoundError: No module named 'ec2_tag_conditional' error? Thanks   Hi
ModuleNotFoundError: No module named 'ec2_tag_conditional'
ModuleNotFoundError: No module named 'ec2_tag_conditional'  Hi, My... named 'ec2_tag_conditional' How to remove the ModuleNotFoundError: No module named 'ec2_tag_conditional' error? Thanks   Hi
ModuleNotFoundError: No module named 'flask-conditional'
ModuleNotFoundError: No module named 'flask-conditional'  Hi, My... named 'flask-conditional' How to remove the ModuleNotFoundError: No module named 'flask-conditional' error? Thanks   Hi, In your
Conditional Statement in Turbo C
Conditional Statement in Turbo C   Write a program that computes and assesses the tuition fee of the students in one trimester, based on the given mode of payment below: Plan (Key) Discount (-) or Interest (+) Cash (1) 10
Conditional Statement in Turbo C
Conditional Statement in Turbo C   Write a program that computes and assesses the tuition fee of the students in one trimester, based on the given mode of payment below: Plan (Key) Discount (-) or Interest (+) Cash (1) 10
Backbase XML/XSLT/Xpath
Backbase XML/XSLT/Xpath       Backbase Enterprise Ajax is targeted at developers who need to create more... XML. The Backbase Ajax Engine includes client-side XSLT and XPath engines. Read
Using the jQuery Transform plug-in(XSLT)
Using the jQuery Transform plug-in(XSLT)       Using the jQuery Transform plug-in(XSLT) XSLT stands for XSL Transformations (Extensible Stylesheet
query regarding auto increment primary key
query regarding auto increment primary key  i want to use s1,s2.... as my auto increment primary key.cant i do this in mysql
Passing parameters to XSLT style sheets
Passing parameters to XSLT style sheets       Passing parameters to XSLT style sheets...() { // For display purposes only $.ajax({ url: 'xslt-test.xml'
Version of com.ocpsoft>ocpsoft-docbook-xslt dependency
List of Version of com.ocpsoft>ocpsoft-docbook-xslt dependency
Version of com.intersult>xslt-maven-plugin dependency
List of Version of com.intersult>xslt-maven-plugin dependency
How to auto increment primary key in mysql...
How to auto increment primary key in mysql...  How to auto increment primary key in mysql... and one more thing i need to get auto increment value in front end each time for inserting the value[JSP

Ads