XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> - How do I copy and create new e... (1)
-> + substring-before and sums (3)
-> - Parsing special characters in ... (2)
-> ->Parsing special character...
-> + Schema - Require attribute in ... (2)
-> - Edit existing XSL files when n... (1)
-> + How can I use one single XSLT ... (2)
-> - Default selection of value in ... (1)
-> - Problem with watermark in pdf ... (1)
-> + XSLT Parameter Values dialog n... (3)
-> + Value of File Name is not acce... (10)
-> - Need help with a complex table... (1)
-> - How to replace all nordic char... (1)
-> - XSLT java heap space error wit... (1)
-> - Table Overflow to next page (1)
-> - Using XSLT 2.0 to define custo... (1)
-> - "standalone" attribute and xs... (1)
-> + Standardizing IP addresses (2)
-> + Programmatically changing page... (6)
-> + Can Stylus generate XSLT if so... (5)
-> + Extraction based on NODE Name. (2)
-> + NO XSLT:WYSIWYG (2)
-- Previous [241-260] [261-280] [281-300] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
leopaul pradeepSubject: Parsing special characters in XSL
Author: leopaul pradeep
Date: 19 Jan 2010 10:32 AM
Hi,

I have an xml with special charcters in a tag ( eg. abc ; bgh). I've used an xslt (given below) to parse it. I'm getting a value for characteristic, which i'm assigning to characteristic_name and setting it as an attribute name. This works fine, but the problem comes if there is a special character in the characteristic. Bcos when setting it as an attribute name parser throws an error. Pls help me to solve the issue.

Thanks in Advance,
Leo

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<data jsxid="jsxroot">
<xsl:apply-templates select="//Envelope/Body/ItemSearchResponse/body"/>
</data>
</xsl:template>
<xsl:template match="body">
<xsl:for-each select="//body/record">
<record>
<xsl:attribute name="jsxid"><xsl:value-of select="jsxid"/></xsl:attribute>
<xsl:attribute name="PRODUCTID"><xsl:value-of select="productId"/></xsl:attribute>
<xsl:attribute name="PRODUCTDESCRIPTION"><xsl:value-of select="productDescription"/></xsl:attribute>
<xsl:apply-templates select="characteristicDetails"/>
</record>
</xsl:for-each>
</xsl:template>
<xsl:template match="characteristicDetails">
<xsl:variable name="characteristic_name" select="characteristic"/>
<xsl:attribute name="{$characteristic_name}">
<xsl:value-of select="characteristicValue"/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>

Posttop
Tony LavinioSubject: Parsing special characters in XSL
Author: Tony Lavinio
Date: 25 Jan 2010 02:17 PM
It's hard to see without the actual incoming XML, which is where you state the problem actually is.

If the incoming XML is invalid, XSLT won't be able to handle it. XSLT doesn't see the XML until the XML parser has parsed it, and if the XML is bad, the parser will stop well before XSLT even knows there is an issue.

   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.