XML to XML transformation
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 1
- Joined: Sat Jan 03, 2015 1:13 pm
XML to XML transformation
Post by makaveli18 »
Hi Guys,
First of all I would like to say hello. I have some major problem (major for me but for some of you this should be a piece of cake).
I have an XML which looks like this:
======================================================================================
<?xml version="1.0"?>
<jderesponse>
<update>
<tables>
<table tablename="ClientCardPosition"/>
</tables>
<condition>
<cond tablename="ClientCardPosition" fieldname="ClientCardPosition-Gr" op="=" value="1"/>
<cond tablename="ClientCardPosition" fieldname="ClientCardPosition-Nr" op="=" value="2150000581"/>
<cond tablename="ClientCardPosition" fieldname="Numer-pozycji" op="=" value="1"/>
</condition>
<fields>
<ClientCardPosition>
<Status-JDE>ERROR</Status-JDE>
<Status-Text>Data-od wcześniejsza od daty zadziałania interfejsu, czyli 2.1.2015</Status-Text>
</ClientCardPosition>
</fields>
</update>
</jderesponse>
======================================================================================
I want to transform it using XSL file to receive such result :
======================================================================================
<?xml version="1.0"?>
<jderesponse>
<update>
<tables>
<table tablename="ClientCardPosition"/>
</tables>
<condition>
<cond tablename="ClientCardPosition" fieldname="klucz" op="=" value="Marged value from all three positions and this is 121500005811"/>
</condition>
<fields>
<ClientCardPosition>
<Status-JDE>Value from Status-JDE element which is "ERROR" </Status-JDE>
<Status-Text>Value from Status-Text element which is "Data-od wcześniejsza od daty zadziałania interfejsu, czyli 2.1.2015"</Status-Text>
</ClientCardPosition>
</fields>
</update>
</jderesponse>
======================================================================================
Could you please help with writing such XSL ?
What I have already is this :
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:var="urn:var"
xmlns:user="urn:user"
xmlns:syncml="SYNCML:SYNCML1.1"
exclude-result-prefixes="msxsl var user syncml"
version="1.0">
<xsl:template match="jderesponse/update">
<update>
<tables>
<table tablename="ClientCardPosition"/>
</tables>
<condition>
<cond tablename="ClientCardPosition" fieldname="klucz" op="="
value=""/>
</condition>
<fields>
<ClientCardPosition>
<Status-JDE><xsl:value-of select="fields/ClientCardPosition/Status-JDE"/></Status-JDE>
<Status-Text><xsl:value-of select="fields/ClientCardPosition/Status-Text"/></Status-Text>
</ClientCardPosition>
</fields>
</update>
</xsl:template>
</xsl:stylesheet>
First of all I would like to say hello. I have some major problem (major for me but for some of you this should be a piece of cake).
I have an XML which looks like this:
======================================================================================
<?xml version="1.0"?>
<jderesponse>
<update>
<tables>
<table tablename="ClientCardPosition"/>
</tables>
<condition>
<cond tablename="ClientCardPosition" fieldname="ClientCardPosition-Gr" op="=" value="1"/>
<cond tablename="ClientCardPosition" fieldname="ClientCardPosition-Nr" op="=" value="2150000581"/>
<cond tablename="ClientCardPosition" fieldname="Numer-pozycji" op="=" value="1"/>
</condition>
<fields>
<ClientCardPosition>
<Status-JDE>ERROR</Status-JDE>
<Status-Text>Data-od wcześniejsza od daty zadziałania interfejsu, czyli 2.1.2015</Status-Text>
</ClientCardPosition>
</fields>
</update>
</jderesponse>
======================================================================================
I want to transform it using XSL file to receive such result :
======================================================================================
<?xml version="1.0"?>
<jderesponse>
<update>
<tables>
<table tablename="ClientCardPosition"/>
</tables>
<condition>
<cond tablename="ClientCardPosition" fieldname="klucz" op="=" value="Marged value from all three positions and this is 121500005811"/>
</condition>
<fields>
<ClientCardPosition>
<Status-JDE>Value from Status-JDE element which is "ERROR" </Status-JDE>
<Status-Text>Value from Status-Text element which is "Data-od wcześniejsza od daty zadziałania interfejsu, czyli 2.1.2015"</Status-Text>
</ClientCardPosition>
</fields>
</update>
</jderesponse>
======================================================================================
Could you please help with writing such XSL ?
What I have already is this :
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:var="urn:var"
xmlns:user="urn:user"
xmlns:syncml="SYNCML:SYNCML1.1"
exclude-result-prefixes="msxsl var user syncml"
version="1.0">
<xsl:template match="jderesponse/update">
<update>
<tables>
<table tablename="ClientCardPosition"/>
</tables>
<condition>
<cond tablename="ClientCardPosition" fieldname="klucz" op="="
value=""/>
</condition>
<fields>
<ClientCardPosition>
<Status-JDE><xsl:value-of select="fields/ClientCardPosition/Status-JDE"/></Status-JDE>
<Status-Text><xsl:value-of select="fields/ClientCardPosition/Status-Text"/></Status-Text>
</ClientCardPosition>
</fields>
</update>
</xsl:template>
</xsl:stylesheet>
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: XML to XML transformation
Post by sorin_ristache »
Hello,
Did you try the xsl-list mailing list? Many XSL experts are available on that list who could help you.
Did you try the xsl-list mailing list? Many XSL experts are available on that list who could help you.
Regards,
Sorin
<oXygen/> XML Editor Support
Sorin
<oXygen/> XML Editor Support
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ 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