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
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
sharath nSubject: filter out hexadecimal characters in a string
Author: sharath n
Date: 22 Jul 2005 06:19 AM
I have an xml file with combination of hexadecimal and ascii characters..
i need an xsl to filter out all the characters other than from List of characters(see below) and replace with '@'

source xml:
<?xml version="1.0"?>
<name>&h0x12;my name</name>

result xml:
<?xml version="1.0"?>
<name>@my name</name>

allowed characters stored in any format depending on our convenience.


<character id="1">a</character>
<character id="2">b</character>
<character id="3">c</character>
<character id="4">d</character>
<character id="5">e</character>
<character id="6">f</character>
<character id="7">g</character>
<character id="8">h</character>
<character id="9">i</character>
<character id="10">j</character>
<character id="11">k</character>
<character id="12">l</character>
<character id="13">m</character>
<character id="14">n</character>
<character id="15">o</character>
<character id="16">p</character>
<character id="17">q</character>
<character id="18">r</character>
<character id="19">s</character>
<character id="20">t</character>
<character id="21">u</character>
<character id="22">v</character>
<character id="23">w</character>
<character id="24">x</character>
<character id="25">y</character>
<character id="26">z</character>
<character id="24">x</character>
<character id="27">1</character>
<character id="28">2</character>

<!-- all the allowed characters are added here -->

one can use combination of javascript and xsl.

i think xsl looks end XSL looks like


<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"

<xsl:output method="xml" indent="yes" encoding="ISO-8859-1"/>

<xsl:template match="/ | @* | node()">
<xsl:apply-templates select="@* | node()"/>

<xsl:template match="text()">
<xsl:value-of select="."/> <!-- here we have to filter out hexadecimal characters -->


Thanks for your reply

Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
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!  

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.