Subject: Re: [xsl] XML transformation based on parameters From: Emiliano Pecis <emiliano.pecis@xxxxxxxxx> Date: Tue, 14 Apr 2009 17:35:47 +0200 |
Michael, you are absolutely right. I'm sorry. Thanks, e. 2009/4/14 Michael Kay <mike@xxxxxxxxxxxx>: >> >> <xsl:template match="param[@name=' { $p } ']"> <xsl:text>{ >> >> but it doesn't work! What other am I missing? > > Please, never say "it doesn't work". Say how it fails (exactly how). > Otherwise we have to stare at your code to see if we can spot what's wrong. > In this case it's fairly obvious, though: you NEVER use curly braces in an > XPath expression or XSLT match pattern. This should be: > > <xsl:template match="param[@name=$p]"> > > That's legal in XSLT 2.0 but not in 1.0 (in 1.0, patterns can't contain > variable references). > > Michael Kay > http://www.saxonica.com/ > >> >> Vasu, this my question should answer to your one! :) >> >> Thanks again!!!! >> e. >> >> >> 2009/4/14 Vasu Chakkera <vasucv@xxxxxxxxx>: >> >> <Catalog> >> >> <Id> newvalue </Id> >> >> </Catalog> >> > >> > where will you get this "newvalue" from ? Presumably it >> wont be in the >> > XML.. or will it? >> > Vasu >> > >> > 2009/4/14 Emiliano Pecis <emiliano.pecis@xxxxxxxxx>: >> >> Hi All, >> >> >> >> I'm using latest version of Stylus Studio, to develop a >> XSLT (based >> >> on Saxon 9.0.1.5 processor) to do the following simple (should be) >> >> transformation. >> >> >> >> From XML: >> >> >> >> <GetCatalog> >> >> <ListOfCatalog> >> >> <Catalog> >> >> <Id> <param name="same/new">foo</param> </Id> >> >> </Catalog> >> >> </ListOfCatalog> >> >> </GetCatalog> >> >> >> >> The destination must depends on "name" attribute of param >> element. If >> >> name="same" the following XML must be returned: >> >> >> >> <GetCatalog> >> >> <ListOfCatalog> >> >> <Catalog> >> >> <Id> foo </Id> >> >> </Catalog> >> >> </ListOfCatalog> >> >> </GetCatalog> >> >> >> >> Otherwise: >> >> >> >> <GetCatalog> >> >> <ListOfCatalog> >> >> <Catalog> >> >> <Id> newvalue </Id> >> >> </Catalog> >> >> </ListOfCatalog> >> >> </GetCatalog> >> >> >> >> In both cases <param> element has to be removed. >> >> >> >> Now, I have two issues. First of all the management of this >> >> "parameters".Secondly, every xml elements (GetCatalog, >> ListOfCatalog, >> >> etc etc) could change: only tag "param" will be the same. >> >> >> >> Thanks a lot in advance, >> >> emiliano >> >> >> >> >> > >> > >> > >> > -- >> > Vasu Chakkera >> > Numerical Algorithms Group Ltd. >> > Oxford >> > www.vasucv.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XML transformation based , Michael Kay | Thread | Re: [xsl] XML transformation based , Sam Byland |
RE: [xsl] XML transformation based , Michael Kay | Date | Re: [xsl] XML transformation based , Sam Byland |
Month |