473,405 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Problem Transforming XML Document That Has A Quote in a parameter

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&apos;' with a single quote

[code]

<xsl:param name="search-for" select=" 'a&apos; "/>

[code]
The XSL Transformation fails and returns the following error

A string literal was not closed.
'a'-->'<--

The XML Parser is thinking the '&apos; 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&quot; A Meats" EntityId="3021"
rsposition="1"/>
<row SAPVendorRef="57232" VendorName="A&apos;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,'abcdefghijklmnopqrstuv wxyz','
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
Jul 20 '05 #1
0 4100

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: VR | last post by:
First, greetings to everyone :) I'm doing a university seminar & I've encountered a problem. I have a gallery with thumbnails linked on pictures. What I want is popup to be opened with...
4
by: Showjumper | last post by:
I am using the NITF DTD for my xml files and i need to use 2 xsl files to do the transform: one for the <body.head> and the second for the <body.content>. I've got this so far for transforming...
4
by: Cathie | last post by:
Hi All, I am trying to get my style sheet to work. It works fine in IE but I can't get it to work in .net. Below is the function I use for transforming, where advancedOptionsFile is the path...
0
by: KathyB | last post by:
Hi, This problem is KILLING my project. I'm transforming an xml doc (step by step instruction documents) in asp.net web form. I've tried using the xml web control and the following code: ...
5
by: Gustaf | last post by:
I've been trying to update my code to the new XslCompiledTransform class without success. The following method takes an XML and XSL file, and returns an XmlDocument object. Can anyone figure out...
0
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile...
1
by: garey | last post by:
Here are two URLs http://library11.berkeley.edu/~gmills/binds_result.xml http://library11.berkeley.edu:8080/noidbind/binds_result.xml In Firefox 2, the first URL results in the XSL...
1
by: scmorgan | last post by:
Hi All, I am trying to come up with a solution for transforming a complex type ie xml ... <document> <label> This is a <highlight> string</highlight> </label>
10
by: Mauro | last post by:
I'm trying to use the following VB function to transform a pdf document to a tiff one: http://forums.microsoft.com/msdn/showpost.aspx?postid=1665127&siteid=1&sb=0&d=1&at=7&ft=11&tf=0&pageid=1 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.