[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] XML attribute value to pattern match of the replace function


Subject: [xsl] XML attribute value to pattern match of the replace function
From: "Selvaganesh" <selvaganesh_t@xxxxxxxxxxxxxx>
Date: Sat, 20 Feb 2010 21:04:04 +0530

Dear Team,

How can I assign the attribute value to pattern of the replace function,
kindly guide me.

Input XML:
<caseref party1="Drury" party2="Secretary of State for the Environment, Food
and Rural Affairs">Drury v Secretary of State for the Environment, Food and
Rural Affairs [2004] EWCA Civ 200; [2004] 1 W.L.R. 1906 </caseref>

XSL:
<hov:template match="caseref">
<hov:element name="caseref"><hov:value-of select="replace(.,
'(@party1.*?@party2)', '&lt;cite&gt;$1&lt;/cite&gt;')"/></hov:element>
</hov:template>

Needed XML:
<caseref party1="Drury" party2="Secretary of State for the Environment, Food
and Rural Affairs"><cite>Drury v Secretary of State for the Environment,
Food and Rural Affairs</cite> [2004] EWCA Civ 200; [2004] 1 W.L.R. 1906
</caseref>

Note: I have defined in char-map for &lt; and &gt;

Thanks,
Selva


Confidentiality Notice:  This transmittal is a confidential communication.  If you are not the intended recipient, you are hereby notified that you have received this transmittal in error and that any review, dissemination, distribution or copying of this transmittal is strictly prohibited.  If you have received this communication in error, please notify this office immediately by reply and immediately delete this message and all of its attachments, if any.


Current Thread