[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSL Stylesheet and using a metadata file

Subject: XSL Stylesheet and using a metadata file
From: "Jim Neff" <jneff@xxxxxxxxxxxxxxx>
Date: Tue, 15 Feb 2005 08:16:06 -0500
metadata stylesheet
Greetings,

I am using an XML document as metadata for defining the fields of the flat
files I am trying to generate.

I thought at one point this was working but something must have changed
because I am no longer getting the desired results and I need help getting
back on track.

In my metadata XML file I have the following sample:

<records>
	<type_AA0>
		<record>
			<field_no>1</field_no>
			<starting_position>1</starting_position>
			<length>3</length>
			<justification>L</justification>
			<content></content>
			<default_value>AA0</default_value>
			<data_type>text</data_type>
			<name>record_id</name>
		</record>
		<record>	
			<field_no>1</field_no>
			<starting_position>1</starting_position>
			<length>3</length>
			<justification>L</justification>
			<content></content>
			<default_value>xxx</default_value>
			<data_type>text</data_type>
			<name>record_id</name>
			<plan_id>abc</plan_id>
		</record>
	</type_AA0>
</records>

This gets loaded into my stylesheet with this command:

<xsl:variable name="field_definitions"
select="document('my_metadata.xml')/records"/>

Here is my template:

<xsl:template match="claim_file">

	<xsl:apply-templates select="$field_definitions/type_AA0/*[(plan_id
= current()/provider[1]/claim[1]/plan_id) or (not(plan_id) and
(not(field_no=../type_AA0/*[plan_id =
current()/provider[1]/claim[1]/plan_id]/field_no)))]">
		
			<xsl:sort select="field_no" order="ascending"
data-type="number"/>
		
			<xsl:with-param name="current_context" select="."/>
						
		</xsl:apply-templates>

</xsl:template>

<xsl:template match="record">
	
		<xsl:param name="current_context"/>

	<!-- The rest of this code isn't relevant to my problem 
		but eventually (after going through a padding template) the
value gets printed out 
		to the output document -->

</xsl:template>

Here is a sample of my input XML document :

<?xml version='1.0' encoding='UTF-8'?>
<claim_file>
   <process_date>2005-02-10T02:21:49</process_date>
   <provider>
      <provider_organization_name>Best Eye Care</provider_organization_name>
      <claim>
		<plan_id>abc</plan_id>
	</claim>
   </provider>
</claim_file>

What I want to happen is, I want the field record from the metadata that
corresponds to the plan_id for this file (all claims will have the same
plan_id so I just use the first claim of the first provider to determine
what the plan_id is).  If there is no plan_id in the metadata file that
matches the one for the source file then I want to use the default field
record.  That is, the one with no plan_id elements in it.

What I exepct from the above output is:

"abc"

What I get is:

"AA0abc"

My problem is that it is not excluding the 'default' field record from my
metadata file.  If I run this with a different plan_id in the source XML
file, such as "def" then it will produce:  "AA0".

So it ALWAYS includes the default field record and then it will select the
field record for that plan if it matches.  What I want is either or, never
both.  Does that make sense?

Thanks much in advance,
Jim Neff

"Iway owknay atthay Iway owknay othingnay aboutway XSLTAY"

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.