[xsl] More newbie questions

Subject: [xsl] More newbie questions
From: mylistaddress@xxxxxxxxxx
Date: Mon, 21 Mar 2005 18:51:39 -0800 (PST)
I have a number of questions which once again I am not
quite sure how to ask, but here it goes.

Here is a sample of some XML I need to deal with:

<Database DatabaseName="2004DATA" />
	<Record number="1">
		<Field FieldName="DOCID">SAP1234</Field>
		<Field FieldName="COUNTRY">USA</Field>
		<Field FieldName="CITY">Baltimore</Field>
		<Field FieldName="TEXT">Baltimore is a
&lt;b&gt;big&lt;/b&gt; city...</Field>
	<Record number="2">
		<Field FieldName="DOCID">XYZ4433</Field>
		<Field FieldName="COUNTRY">Canada</Field>
		<Field FieldName="CITY">Toronto, Montreal</Field>
		<Field FieldName="TEXT">Toronto and Montreal are in
	<Record number="3">
		<Field FieldName="DOCID">ABC123</Field>
		<Field FieldName="COUNTRY">Sweden</Field>
		<Field FieldName="CITY">Stockholm</Field>
		<Field FieldName="TEXT">Stockholm is a
&lt;b&gt;big&lt;/b&gt; city also...</Field>

1- My first issue concerns the Database tag. As you can
see, I receive an XML response with 1 response and
multiple Records nested within it. I need to 
extract each "Record" and transform it to be different
XML (no attribute names for one thing...), and I need
to add the value in the Database tag (2004DATA) to each
"Record" before inserting the doc as a CLOB into a
database. The problem is, my limited xsl skills have
allowed me to extract the data I need, but I can't
figure out how to get the database name value into each
record. I tried assigning the value to a variable with
xsl:variable, but the transformation fails. Any help

2- How would I create multiple CITY tags in the output
when faced with a response like that in record # 2,
where the value is Toronto, Montreal?  I don't want a
comma separated value in the body of the tag.

3- You may have noticed the escaped angle brackets for
the HTML tags in the TEXT tag value. How do I have them
display properly? I played with the output="html" and
the escape attribute to no avail.

Sorry to drop so many questions. Any help is greatly


Current Thread