Click to See Complete Forum and Search --> : Hi friends xslt problem plz help


VikramSingh
04-04-2008, 12:22 AM
Hi Alain:
i have one XML input , and with the help of XSLT i have to bring the expected output.

here is my XML input:
<Attributes Protected="false" AddNewP="false" ReOrderP="false">
<ProtectedItem Protected="true">
<Value Name="FA1" DataType="Value" Filter="String">
<string>sdfg</string>
</Value>
</ProtectedItem>
<ProtectedItem Protected="true">
<Value Name="FA12" DataType="FileLink" Filter="*">
<string>D:\TimeSheet\2008\AVLIS_Timesheet_TFMS_VikramSingh_CW_13.xls</string>
</Value>
</ProtectedItem>
<ProtectedItem Protected="false">
<Value Name="FA13" DataType="WebLink" Filter="*">
<string>http://localhost:1799/CfgWS</string>
</Value>
</ProtectedItem>
<ProtectedItem Protected="true">
<Value Name="FA14" DataType="Attachment" Filter="*.*">
<ReferenceObjectPaco Name="corpora.txt" Date="2007-08-02T10:15:39.65625+05:30" Size="699" FilePath="C:\Documents and Settings\SINGHV\Desktop\Jan Kachra\corpora.txt" Modified="true" Zipped="true" ReferenceType="Attachment" DataType="Attachment">
<User />
<Reference Type="Attachment" Name="f7cf713e-dd90-4f5c-a9a1-637084e7385a" PacoRefName="Ref:FA[FA14]" />
<ReferenceValue xmlns:q8="http://www.w3.org/2001/XMLSchema" p7:type="q8:string" xmlns:p7="http://www.w3.org/2001/XMLSchema-instance">corpora.txt</ReferenceValue>
</ReferenceObjectPaco>
</Value>
</ProtectedItem>
<ProtectedItem Protected="false">
<Value Name="FA15" DataType="Standard" Filter="*.*">
<ReferenceObjectPaco Name="FA15" Date="2008-04-01T14:02:03.6875+05:30" UserName="System" Size="80384" FilePath="C:\Documents and Settings\leinera\Desktop\TFMS Training\TFMS-Glossary V1_1.xls" Modified="false" Zipped="false" ReferenceType="Standard" DataType="Standard" Filter="*.*">
<User />
<Reference Type="Standard" SubType="xls" Name="Glossary" PacoRefName="Ref:FA[FA15]" />
<ReferenceValue xmlns:q9="http://www.w3.org/2001/XMLSchema" p7:type="q9:string" xmlns:p7="http://www.w3.org/2001/XMLSchema-instance">Glossary</ReferenceValue>
</ReferenceObjectPaco>
</Value>
</ProtectedItem>
<ProtectedItem Protected="true">
<Value Name="FA16" DataType="Value" Filter="Integer">
<string>234</string>
</Value>
</ProtectedItem>
</Attributes>

using XSLT i have to bring the following output:

<FreeAttribute Name="FA1" DataType="Value" Filter="String" Value="sdfg" />
<FreeAttribute Name="FA12" DataType="FileLink" Filter="*" Value="D:\TimeSheet\2008\AVLIS_Timesheet_TFMS_VikramSingh_CW_13.xls" />
<FreeAttribute Name="FA13" DataType="WebLink" Filter="*" Value="http://localhost:1799/CfgWS" />
<FreeAttribute Name="FA14" DataType="Attachment" Filter="*.*" Value="" />
<FreeAttribute Name="FA15" DataType="Standard" Filter="*.*" Value="" />
<FreeAttribute Name="FA16" DataType="Value" Filter="Integer" Value="234" />

My question is what is to be written in XSLT so that i could bring the above output. i kindly request anyone to reply to this request as soon as possible

Alain COUTHURES
04-04-2008, 02:52 AM
Try this stylesheet :<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<Attributes>
<xsl:for-each select="/Attributes/ProtectedItem">
<FreeAttribute Name="{Value/@Name}" DataType="{Value/@Name}" Filter="{Value/@Name}" Value="{Value/string}"/>
</xsl:for-each>
</Attributes>
</xsl:template>
</xsl:stylesheet>

VikramSingh
04-06-2008, 11:00 PM
Hi Alain
thanks for the help But i made some changes to get the desired result...
Thanks for the help
I have one more problem for which i have to send You my input XML and XSLT that i have written..
But i am unable to send it through this can u plz tell me the way around to send the Xml and XSLT
Regards:
Vikram

jkmyoung
04-08-2008, 11:48 AM
One way would be to put this type of processing instruction at the top of your xml input.
<?xml-stylesheet type="text/xsl" href="Untitled2.xslt"?>

Other ways would be to use an extra language to mix the 2 together, eg PHP, javascript, ASP, C#, etc..


Also just a note on English. Unfortunately, the way you phrased your response comes off as rude. This probably isn't the way you intended.
-----
thanks for the help But i made some changes to get the desired result...
---
The word 'But' negates the phrase, as if the 'help' was no help at all, and also implying sarcasm.
A more polite way to phrase this could be:
--
Thanks for the help; with this I made a few changes to get the desired result.
--

'But' is a word I reccommend never using.