Solved

EASY: Parsing lists with XSL - removing that extra comma...

Posted on 2011-03-23
3
484 Views
Last Modified: 2013-11-11
Greetings, I am using XSL to parse a number of records, with a rule silmilar to:
<xsl:if test="binding">
	,"binding" : {
		"field" : "<xsl:value-of select="binding/entity/field"/>"
	}
</xsl:if>

Open in new window


The problem is, I always get an extra comma, either at the end or at the beginning - which screws up my JSON parsing later.

Is there a reliable way of having a different output for the first or the last parsed element?
0
Comment
Question by:Emanuele_Ciriachi
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 256 total points
ID: 35197181
totally depends on your XSLT

if you made the right apply-templates selection (meaning that only the binding parent is passed and not the white-space only text nodes as well)
you can rely on position()=1

but I need to see more of the XSL and the source XML to show you what to do
0
 
LVL 1

Author Closing Comment

by:Emanuele_Ciriachi
ID: 35230194
Thanks.
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 35275461
welcome
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now