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

Re: Attribute value

Subject: Re: Attribute value
From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx>
Date: Sat, 26 Nov 2005 22:21:27 +0530
fdsfdfdf
Hi Shailesh,
  There are well formdness errors in your source XML. In the output
HTML, in the first instance you desire <test name="local" and in the
second instance you desire <test name="NAME". I guess this is a typo,
and you desire <test name="local" in both the cases. I am also curious
that <test is not a HTML tag or this is what you want. Can you clarify
all the points?

Below are the source XML and the stylesheet I think you need

<root>
<file path="c:\test\test001\sec1.htm">
<top>
<p>asafdsf</p>
<keys>
<key>fdsfdfdf</key>
<key>kjkhkhhj</key>
</keys>
</top>
</file>
<file path="c:\test\test001\sec2.htm">
<top>
<p>asafdsf</p>
<keys>
<key>fdsfdfdf</key>
<key>kjkhkhhj</key>
</keys>
</top>
</file>
</root>

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:output method="html" />

<xsl:template match="/root">
   <html>
     <head>
       <title/>
     </head>
     <body>
       <ul>
         <xsl:for-each select="file">
           <li>
             <xsl:for-each select="top/keys/key">
               <test name="Name" value="{.}"/>
             </xsl:for-each>
             <test name="local" value="{@path}"/>
           </li>
         </xsl:for-each>
       </ul>
     </body>
   </html>
</xsl:template>

</xsl:stylesheet>

Regards,
Mukul

On 11/25/04, Shailesh Shinde <shailesh@xxxxxxxxxxxx> wrote:
> Hi All,
>
> I have an xml file as:
>
> <file path="c:\test\test001\sec1.htm">
> <top>
> <p>asafdsf</p>
> <keys>
> <key>fdsfdfdf</key>
> <key>kjkhkhhj</key>
> </keys>
> <top>
> </file>
> <file path="c:\test\test001\sec2.htm">
> <top>
> <p>asafdsf</p>
> <keys>
> <key>fdsfdfdf</key>
> <key>kjkhkhhj</key>
> </keys>
> <top>
> </file>
>
> And so on....
>
> I am trying to get the output as:
>
> <html><body>
> <ul><li>
> <test name=Name value="fdsfdfdf"/>
> <test name=Name value=" kjkhkhhj "/>
> <test name="local" value="c:\test\test001\sec1.htm"/>
> </li>
> <li>
> <test name=Name value="fdsfdfdf"/>
> <test name=Name value="kjkhkhhj"/>
> <test name="NAME" value="c:\test\test001\sec2.htm"/>
> </li>
> </ul>
> </body></html>
>
>
> When I am searching for key value from particular file the @path value
> should come in value="" attribute.
>
>
> How should i get this?
>
> Thanks,
> Shailesh

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.