|
|
|
date: Tue, 27 May 2008 19:58:01 -0700,
group: microsoft.public.xml
back
XSL HELP!!
Hello,
I have a XMl as below:
*******************
<?xml version="1.0" ?>
<p1:Domains_and_Emails xmlns:p1="LDAP">
<Organization>ABCD</Organization>
<Radius Suspended="false" ID="1" Platform_Id="7"
ObjectClass="radiusprofile">
<Common_Name>OptiUser</Common_Name>
<radiusProfileDn>cn=dialup,ou=radiusprofiles,o=ABCD</radiusProfileDn>
</Radius>
<Domain Suspended="false" ID="2" Platform_Id="7">
<Organization_Unit>domains</Organization_Unit>
<domain_name>xyztel.com</domain_name>
<UnixEmail Suspended="false" ID="3" Platform_Id="7"
ObjectClass="radiusprofile,posixAccount,CourierMailAccount">
<uid>info</uid>
<Password>xyz</Password>
<EmailAccount>info@xyztel.com</EmailAccount>
</UnixEmail>
<UnixEmail Suspended="false" ID="4" Platform_Id="7"
ObjectClass="radiusprofile,posixAccount,CourierMailAccount">
<uid attributeId="1">jeff</uid>
<Password attributeId="4">xyz</Password>
<EmailAccount>jeff@xyztel.com</EmailAccount>
</UnixEmail>
<UnixEmail Suspended="false" ID="72" Platform_Id="7"
ObjectClass="radiusprofile,posixAccount,CourierMailAccount">
<uid attributeId="1">ff</uid>
<Password attributeId="4">xyz</Password>
<EmailAccount>ff@xyztel.com</EmailAccount>
</UnixEmail>
</Domain>
</p1:Domains_and_Emails>
*******************
Using a XSL template, how to get ONLY the node UnixEmail with attribute ID
value = 4 PLUS ALL OTHER NODES (such as <Organization>)
Thanks,
Ganesh
date: Tue, 27 May 2008 19:58:01 -0700
author: Ganesh Muthuvelu
Re: XSL HELP!!
Martin,
Thanks for your help. I have one question on this. Is it possible to have a
variable name for the template "match"?.
The reason I am asking this is: The node "UnixEmail" is NOT static and may
change dynamically, for example, it could be even the "Domain" node..
So, is it possible to have something like this n XSL:?
<xsl:template match=@DynamicNodeName>
Thanks,
Ganesh
"Martin Honnen" wrote:
> Ganesh Muthuvelu wrote:
>
> > Using a XSL template, how to get ONLY the node UnixEmail with attribute ID
> > value = 4 PLUS ALL OTHER NODES (such as <Organization>)
>
> Here is a sample stylesheet:
>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>
> <xsl:param name="id" select="4"/>
>
> <xsl:output method="xml"/>
>
> <xsl:template match="@* | node()">
> <xsl:copy>
> <xsl:apply-templates select="@* | node()"/>
> </xsl:copy>
> </xsl:template>
>
> <xsl:template match="UnixEmail">
> <xsl:if test="@ID = $id">
> <xsl:copy-of select="."/>
> </xsl:if>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
> Result with your XML sample is
>
> <p1:Domains_and_Emails xmlns:p1="LDAP">
> <Organization>ABCD</Organization>
> <Radius Suspended="false" ID="1" Platform_Id="7"
> ObjectClass="radiusprofile">
> <Common_Name>OptiUser</Common_Name>
> <radiusProfileDn>cn=dialup,ou=radiusprofiles,o=ABCD</radiusProfileDn>
> </Radius>
> <Domain Suspended="false" ID="2" Platform_Id="7">
> <Organization_Unit>domains</Organization_Unit>
> <domain_name>xyztel.com</domain_name>
>
>
>
> <UnixEmail Suspended="false" ID="4" Platform_Id="7"
> ObjectClass="radiusprofile,posixAccount,CourierMailAccount">
> <uid attributeId="1">jeff</uid>
> <Password attributeId="4">xyz</Password>
> <EmailAccount>jeff@xyztel.com</EmailAccount>
> </UnixEmail>
>
>
>
> </Domain>
>
> </p1:Domains_and_Emails>
>
>
> --
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
>
date: Wed, 28 May 2008 06:43:01 -0700
author: Ganesh Muthuvelu
|
|