[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2011-03-23
3
Medium Priority
?
507 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

649 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