This XSLT has stumped me..
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 3
- Joined: Tue Apr 27, 2010 8:05 am
This XSLT has stumped me..
Hi,
I have a complex XSLT transformation and I am trying to figure out how to proceed with.
I am attempting to collect the information associated to a particular PortId. However this information is distributed across various elements as indicated below.
In the example below the information for port_id2 is across two <Map> elements. How would I extract the DOMAIN_ID associated to the same port_ids and transform them into the <ServicePort> element in the output xml.
Input.xml -
<AttributeList>
<Map>
<entry>
<key>PortId</key>
<value>port_id1</value>
</entry>
<entry>
<key>DOMAIN_ID</key>
<value>one</value>
</entry>
</Map>
<Map>
<entry>
<key>PortId</key>
<value>port_id2</value>
</entry>
<entry>
<key>DOMAIN_ID</key>
<value>13</value>
</entry>
</Map>
<Map>
<entry>
<key>PortId</key>
<value>port_id2</value>
</entry>
<entry>
<key>DOMAIN_ID</key>
<value>14</value>
</entry>
</Map>
</AttributeList>
Transformed.xml -
<?xml version="1.0"?>
<ServicePorts>
<ServicePort>
<PortId>port_id1</PortId>
<ServicePortDetails>
<VlanId>one</VlanId>
</ServicePortDetails>
</ServicePort>
<ServicePort>
<PortId>port_id2</PortId>
<ServicePortDetails>
<VlanId>13</VlanId>
</ServicePortDetails>
<ServicePortDetails>
<VlanId>14</VlanId>
</ServicePortDetails>
</ServicePort>
</ServicePorts>
<BandwidthSubscriptions>
Apologies for loosing the indentation but I couldn't get it right
.
Thanks in advance.
Regards
Ananya
I have a complex XSLT transformation and I am trying to figure out how to proceed with.
I am attempting to collect the information associated to a particular PortId. However this information is distributed across various elements as indicated below.
In the example below the information for port_id2 is across two <Map> elements. How would I extract the DOMAIN_ID associated to the same port_ids and transform them into the <ServicePort> element in the output xml.
Input.xml -
<AttributeList>
<Map>
<entry>
<key>PortId</key>
<value>port_id1</value>
</entry>
<entry>
<key>DOMAIN_ID</key>
<value>one</value>
</entry>
</Map>
<Map>
<entry>
<key>PortId</key>
<value>port_id2</value>
</entry>
<entry>
<key>DOMAIN_ID</key>
<value>13</value>
</entry>
</Map>
<Map>
<entry>
<key>PortId</key>
<value>port_id2</value>
</entry>
<entry>
<key>DOMAIN_ID</key>
<value>14</value>
</entry>
</Map>
</AttributeList>
Transformed.xml -
<?xml version="1.0"?>
<ServicePorts>
<ServicePort>
<PortId>port_id1</PortId>
<ServicePortDetails>
<VlanId>one</VlanId>
</ServicePortDetails>
</ServicePort>
<ServicePort>
<PortId>port_id2</PortId>
<ServicePortDetails>
<VlanId>13</VlanId>
</ServicePortDetails>
<ServicePortDetails>
<VlanId>14</VlanId>
</ServicePortDetails>
</ServicePort>
</ServicePorts>
<BandwidthSubscriptions>
Apologies for loosing the indentation but I couldn't get it right

Thanks in advance.
Regards
Ananya
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: This XSLT has stumped me..
Post by sorin_ristache »
Hello,
Maybe the following two tutorials can help you to get started with XSLT templates and XPath expressions:
http://www.w3schools.com/xsl/xsl_intro.asp
http://www.w3schools.com/xpath/default.asp
Regards,
Sorin
Maybe the following two tutorials can help you to get started with XSLT templates and XPath expressions:
http://www.w3schools.com/xsl/xsl_intro.asp
http://www.w3schools.com/xpath/default.asp
Regards,
Sorin
-
- Posts: 3
- Joined: Tue Apr 27, 2010 8:05 am
Re: This XSLT has stumped me..
Hi Sorin,
Thanks for the reply.
Though I am a newbie to XSLT but I have some idea about it.
I require help in solving this specific issue.
If you are good at it can you help me out with a solution.
Regards
Ananya
Thanks for the reply.
Though I am a newbie to XSLT but I have some idea about it.
I require help in solving this specific issue.
If you are good at it can you help me out with a solution.
Regards
Ananya
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service