Transforming xml using xslt
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 1
- Joined: Mon Nov 17, 2014 1:25 pm
Transforming xml using xslt
Hi All,
I am new to xslt and working on a project to transfer one xml into another.
The issue I am getting is while iterating and assigning values as shown below.
Example XML1:
Now when i use xslt to get each values for further processing it is taking first value everytime. Like
Here for the first iteration it will print "FirstValue" but in second iteration as well, instead of printing second value it is priting FirstValue. Could you please tell me where am I going wrong?
Thanks.
I am new to xslt and working on a project to transfer one xml into another.
The issue I am getting is while iterating and assigning values as shown below.
Example XML1:
Code: Select all
<something:Main id="id8" modifiedDate="2014-11-14 14:33:33">
<something:Parent>FirstValue</something:Parent>
<something:Parent>SecondValue</something:Parent>
<something:Parent>ThirdValue</something:Parent>
<something:Parent>FourthValue</something:Parent>
<something:Parent>FifthValue</something:Parent>
<something:Parent>SixthValue</something:Parent>
</something:Main>
Code: Select all
<xsl:for-each select="//something:Main/something:Parent">
<xsl:variable name="ClassId">
<xsl:value-of select="//something:Parent" />
</xsl:variable>
<xsl:element name="Testing">
<xsl:attribute name="ClassID">
<xsl:value-of select="$ClassId" />
</xsl:attribute>
</xsl:element>
</xsl:for-each>
Thanks.
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Transforming xml using xslt
Hi,
You're not using the current context (.) in the for-each statement.
http://www.w3schools.com/xsl/xsl_for_each.asp
Instead of
Try
Regards,
Adrian
You're not using the current context (.) in the for-each statement.
http://www.w3schools.com/xsl/xsl_for_each.asp
Instead of
Code: Select all
<xsl:value-of select="//something:Parent"/>
Code: Select all
<xsl:value-of select="." />
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
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