Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: using xsl file to parse out a chunk of XML

From: paul_0403@-----.---
To: NULL
Date: 1/7/2009 10:09:00 AM
On Jan 7, 12:26=A0pm, Martin Honnen <mahotr...@yahoo.de> wrote:
> paul_0...@yahoo.com wrote:
> > this is the version of xsltproc I am using so what ever will work this
> > this.
>
> libxslt is XSLT 1.0. But if all of those params are provided then XSLT
> 2.0 is not needed I think:
>
> =A0 =A0<xsl:param name=3D"id"/>
>
> =A0 =A0<xsl:param name=3D"pid"/>
>
> =A0 =A0<xsl:param name=3D"tid"/>
>
> =A0 =A0<xsl:template match=3D"/">
> =A0 =A0 <xsl:copy-of
> =A0 =A0 =A0 select=3D"root/query[content =3D concat('id=3D', $id, ';pid=
=3D', $pid,
> ';tid=3D', $tid)]"/>
> =A0 =A0</xsl:template>
>
> --
>
> =A0 =A0 =A0 =A0 Martin Honnen
> =A0 =A0 =A0 =A0http://JavaScript.FAQTs.com/


Sorry to bother you but this is what I have and it does not seem to be
working.

a.xsl

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

       <xsl:output method=3D"text"/>
       <xsl:strip-space elements=3D"*"/>

       <xsl:param name=3D"id" select =3D "'UNDEFINED'"/>
       <xsl:param name=3D"pid"  select =3D "'UNDEFINED'"/>
       <xsl:param name=3D"tid"  select =3D "'UNDEFINED'"/>

       <xsl:template match=3D"/">
               <xsl:copy-of select=3D"root/query[content =3D concat('id=3D'=
,
$id, ';p
d=3D', $pid, ';tid=3D', $tid)]"/>
       </xsl:template>

</xsl:stylesheet>

the single root element in my XML is <queries>

<queries>
  <query id=3D"8124-1228816866" chunk=3D"0" desc=3D"">
    <context>id=3D1005;pid=3D5208;tid=3D5400</context>
     <a>111</a>
     <b>222</b>
     <c>333</c>
 </query>
 <query id=3D"8124-1228816867" chunk=3D"0" desc=3D"">
    <context>id=3D1006;pid=3D5278;tid=3D5400</context>
     <a>444</a>
     <b>555</ba>
     <c>666</c>
   </query>
</queries>

I am calling it like this:

xsltproc --param id '1005' --param pid '5208' --param tid '5400' ./
a.xsl ./a.xml

Am I missing something?



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent