Subject: [xsl] Altering specific value then outputing tree AGAIN..... From: mmackay@xxxxxxxxxxx Date: Fri, 13 Jul 2001 15:02:50 +0100 |
********************************************************************* * Scottish Equitable plc * * Registered Office: Edinburgh Park, Edinburgh EH12 9SE. * * Regulated by the Personal Investment Authority. * * A member of the Scottish Equitable Marketing Group. * ********************************************************************* Hi again I posted a few days ago with the following problem: I want to be able to output the piece of XML (below) with a member_number included in my output document. <person id="pc1"> <title>Miss</title>> <forenames>La</forenames> <surname>La</surname> <sex>Female</sex> <marital_status>Married</marital_status> <date_of_birth>1960-11-04</date_of_birth> <home_address id="ad1"> <line1>TellyTubbyStreet</line1> <line2>Lala land</line2> <country>Scotland</country> <postcode>EH35 2LH</postcode> </home_address> <employment_status>Employed</employment_status> <applicant> <member_number/> </applicant> <national_insurance_number>LL234567T</national_insurance_number > <retirement_age>60</retirement_age> </person> I can do this fine by doing an <xsl:copy-of select="//person"/> but I want to be able to change the value of the member_number tag before outputing the above so that it contains a number. I am going to get the value for the member_number from elsewhere within my XML document. Is there an easy way of doing this rather than a <xsl:copy-of..> of each individual element within the above tree?? I want the output to look as below. <person id="pc1"> <title>Miss</title>> <forenames>La</forenames> <surname>La</surname> <sex>Female</sex> <marital_status>Married</marital_status> <date_of_birth>1960-11-04</date_of_birth> <home_address id="ad1"> <line1>TellyTubbyStreet</line1> <line2>Lala land</line2> <country>Scotland</country> <postcode>EH35 2LH</postcode> </home_address> <employment_status>Employed</employment_status> <applicant> <member_number>10114<member_number> </applicant> <national_insurance_number>LL234567T</national_insurance_number > <retirement_age>60</retirement_age> </person> Below is a response that I received to my question, but I could not produce the output I desired, I tried to alter the below in many different ways but to no success. The closest I came was to produce the output but with no attribute values displayed. Write an identity template rule for most elements <xsl:template match="*"> <xsl:copy-of select="*"/> <xsl:copy><xsl:apply-templates/></xsl:copy> </xsl:template> and override it with a special rule for member_number <xsl:template match="member_number"> <member_number><xsl:value-of select="..."/></member_number> </xsl:template> Any help would be much appreciated. Cheers Mo ______________________________________________________________________ EMAIL DISCLAIMER This message is for the intended recipient only. It may contain confidential or proprietary information. If you receive this message in error, please immediately delete it, destroy all copies of it and notify the sender. You must not use or disclose any part of this message if you are not the intended recipient. We may monitor all Email communication through our networks. If you contact us by Email, we may store your name and address to facilitate communication. Any views expressed in this message are those of the individual sender, except where the message states otherwise. We take reasonable precautions to ensure our Emails are virus free. However, we cannot accept responsibility for any virus transmitted by us and recommend that you subject any incoming Email to your own virus checking procedures. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[no subject], Alex Genis | Thread | RE: [xsl] Altering specific value t, Michael Kay |
RE: [xsl] Trying to put a <BR> in a, Daniel Newman | Date | RE: [xsl] Trying to put a <BR> in a, Daniel Newman |
Month |