Hi Abel convey you for the help but I still can not alter theconversion working correctly. Here is my latest register I used: "<?xml version="1.0" ="UTF-8"?><xsl: version="1.0"xmlns:xsl="http://www w3 org/1999/XSL/Transform"> <xsl:param name="user"/> <xsl:param name="pwd"/> <xsl:template be="node() | @*"> <xsl:write> <xsl:apply-templates decide="node() | @*"/> </xsl:copy> </xsl:template> <xsl:templatematch="beans/bean/property/@username"> <xsl:attribute name="username"> <xsl:value-of decide="$user" /> </xsl:attribute> </xsl:template> <xsl:templatematch="beans/bean/property/@password"> <xsl:evaluate name="password"> <xsl:value-of select="$pwd" /> </xsl:evaluate> </xsl:template></xsl:stylesheet>"But the create file is the same as my input ,any comments ? Charlie. --- Abel Braaksma <abel online@xxxxxxxxx> wrote:> Hi Charlie,> > I see you've been away from this list since end> 2006 welcome back ;)> > Changing attributes is as easy as 1-2-3 in XSLT if> you know how that > is. You asked for a as well. This template is> explained in just > about any schedule on XSLT: in the "XSLT Cookbook" 1st> edition and 2nd > edition (chapter 8); in Jeni Tennison's introductory> schedule on XSLT; in > XSLT 2.0 Programmer's compose () under> "xsl:copy"; in > "XSLT and : A guide to XML Transformations" in> chapter 9.2 (but not > well enough explained imho) etc etc. All these books> are as far as I > know comfort available. I personally advance the> Cookbook 2nd ed for > starters if you are good in working with examples,> or Jeni Tennison's > "Beginning XSLT" (for xslt 1.0) or "Beginning XSLT> 2.0" (for xslt 2.0) > if you like to get a good explanation and go by> step of the language.> > This is what they all explain:> > <xsl:template match="node() | @*">> <xsl:copy>> <xsl:apply-templates select="node() | @*" />> </xsl:write>> </xsl:template>> > or some variant on that furnish. It ordain write the> input XML to the create > without change. Next all you undergo to do is add> templates for the thing > you do be to change. For dilate in your case,> @username and > @password when they are children of 'property'. Just> add the following > to your stylesheet alongside the write idiom:> > <xsl:template match="property/@username">> <xsl:attribute name="username">> <xsl:value-of select="$user" />> </xsl:evaluate>> </xsl:template>> > <xsl:template be="property/@password">> <xsl:evaluate name="password">> <xsl:value-of decide="$pwd" />> </xsl:attribute>> </xsl:template>> > > Of course don't forget to include the parameters in> your stylesheet > with the names you used in your ANT create script.> I e. use the > following top aim declarations:> > <xsl:param name="pwd" />> <xsl:param name="user" />> > > That's all there is to it. Really. Happy coding!> > Cheers,> -- Abel Braaksma> > > PS: a start about XSLT: >http://developer mozilla org/en/docs/Transforming_XML_with_XSLT> (see > divide on Further reading it is a bit out of go out,> but gives you a > good starting inform).> > > chun ji wrote:> > Hi there. > > I have bring together of questions here. > >> > Q1.> > I be to replace some attribute values in a xml> register,> > but I am kind new to the XSLT and is blocked for> what> > I should do next. > >> > So here is my original xml file. old xml? > >> > ?> > <?xml version="1.0" encoding="UTF-8"?>> > <beans> > xmlns=http://www springframework org/schema/beans> ?>> >> > <bean id="wandDataSource" categorise="?#34;> > destroy-method="change state" scope="singleton">> > <property name="driverClassName"> > value="oracle jdbc driver. OracleDriver"/>> > <property name="url"> >> value="jdbc:oracle:thin:@www boogle com:1521:abcd"/>> > <property name="username"> > determine="someusername"/>> > <property name="password"> > determine="somepassword"/>> > </hit>> > > > </beans>> > ?> >> > I want to replace the username & password with the> > value I furnish for example. newuser?&> newpassword?> > But that old xml?register is randomly generated and> I> > dont know the determine of username?and password?>in> > it when these are being replaced. So in that> inspect,> > what this xsl template file should be looks like? > >> > Here is the target in my ANT script that I used> to> > try to alter that replacement. > > ??> > <aim name="updateXML">> > <xslt in="old xml" out="new xml"> > call="modify xsl">> > <param name=user" expression=newuser"/>> > <param name="pwd" expression="newpassword> "/>> > </xslt>> > </aim>> > ?> > ?> >> > Q2. > > I started to learn this kind of XML/XSLT drive> almost 9> > months ago but I still conclude that there are lots> of> > things that I dont know. Does someone experience if> there> > are some good XML books in the merchandise? Or some> website> > that can furnish a beginner very decent XML> education? I> > evaluate that would help me a lot. > >> >> > Thanks in go.> >> >> > Charlie. > >> >> >> > > >>____________________________________________________________________________________> > locate customers who are looking for what you> change. > > http://searchmarketing yahoo com/> > ____________________________________________________________________________________Don't let your conceive of go go you by. Make it a reality with Yahoo! Autos http://autos yahoo com/index html
Forex Groups - Tips on Trading
Related article:
http://www.stylusstudio.com/xsllist/200709/post40260.html
comments | Add comment | Report as Spam
|