Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
XML
Problem Transforming XML Document That Has A Quote in a parameter
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="David Furey, post: 767158"] Hi, I am using the XSLT document to filter records from an XML document The XSL is shown below: I have a parameter named "search-for" that is used to bring back a list of Vendor Names that start with this parameter. The list works as I want for alpabetical letters. Setting the parameter to 'a' brings back a list of vendors beginning with 'a' as shown below [Code] <xsl:param name="search-for" select=" 'a' "/> [Code] If I change the parameter to be 'a'' with a single quote [Code] <xsl:param name="search-for" select=" 'a' "/> [Code] The XSL Transformation fails and returns the following error A string literal was not closed. 'a'-->'<-- The XML Parser is thinking the '' character in the literal string is the end of the string where I want it to be treated as part of the string. Does anyone know how I can get the XML parser to treat the quotes inside the parameter to be treated as part of the string. I want the parameter to be able to hold the characters " and ' The files I am using are shown below XML File [Code] <NEXXML xmlns:sql="urn:schemas-microsoft-com:xml-sql"> <columns/> <rows> <row SAPVendorRef="15001" VendorName="A" A Meats" EntityId="3021" rsposition="1"/> <row SAPVendorRef="57232" VendorName="A'bbeyhouse Foods" EntityId="3050" rsposition="2"/> <row SAPVendorRef="15011" VendorName="Alexandra Rentals" EntityId="3023" rsposition="3"/> <row SAPVendorRef="10184" VendorName="Alexandra Workwear PLC" EntityId="3014" rsposition="4"/> <row SAPVendorRef="15012" VendorName="Allied Bakeries NI" EntityId="3024" rsposition="5"/> <row SAPVendorRef="60143" VendorName="Astron On Line" EntityId="3056" rsposition="6"/> <row SAPVendorRef="56531" VendorName="Backgammo'n" EntityId="3048" rsposition="7"/> <row SAPVendorRef="15062" VendorName="British Bakeries NI" EntityId="3025" rsposition="8"/> </rows> </NEXXML> [Code] XSL File [Code] <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sql="urn:schemas-microsoft-com:xml-sql"> <xsl:output method="xml"/> <xsl:param name="search-for" select=" 'a' "/> <!-- convert the param to upper case just once --> <xsl:variable name="uc-search-for" select="translate($search-for,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOP qrstuvwxyz')"/> <xsl:template match="/"> <nexxml> <rows> <xsl:apply-templates/> </rows> </nexxml> </xsl:template> <xsl:template match="rows"> <xsl:apply-templates select="row[starts-with(translate(@VendorName,'abcdefghijklmnopqrstuvwxyz',' abcdefghijklmnopqrstuvwxyz'),$uc-search-for)]"/> </xsl:template> <xsl:template match="row"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet> [Code] Many thanks in advance for any responses David[/Code] [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
XML
Problem Transforming XML Document That Has A Quote in a parameter
Top