?
Solved

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

Posted on 2011-03-23
3
Medium Priority
?
503 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 1024 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month15 days, 2 hours left to enroll

770 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