Re: Abt Libxslt use in replace function
James Fuller <[email protected]>
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
bhushan wrote: > i have used str:replace in my xsl file > this my XSL file > > <?xml version="1.0" encoding="UTF-8"?> > <xsl:stylesheet version="1.0" xmlns:xsl=" > http://www.w3.org/1999/XSL/Transform" > xmlns:idmef="http://iana.org/idmef" xmlns:str="http://exslt.org/strings" > extension-element-prefixes="str"> > <xsl:import href="replace.xsl" /> > <xsl:variable name="color" > select="idmef:IDMEF-Message/idmef:Alert/idmef:Analyzer/idmef:Node/idmef:name"/> > <xsl:variable name="color1" select="'a'" /> > <xsl:variable name="color2" select="'e'" /> > <xsl:template match="/" > > <xsl:call-template name="str:replace"> > <xsl:with-param name="string" select="color"/> > <xsl:with-param name="search" select="$color1" /> > <xsl:with-param name="replace" select="$color2"/> > </xsl:call-template> this is correct invocation for the str:replace and should return the desired result > <xsl:value-of select="color" /> what does this do? perhaps u want $color > </xsl:template> > </xsl:stylesheet> > > > This is my replace.xsl yes, this is what u should do when underlying XSLT doesnt natively support. with libxslt to find out what EXSLT are natively supported, do the following command; xsltproc --dumpextensions | grep strings or just xsltproc --dumpextensions also not so sure the man page for libexslt is up to date these days > This my XML File > > > <?xml version="1.0" encoding="UTF-8"?> > <?xml-stylesheet type="text/xsl" href="cd-price.xsl"?> > <idmef:IDMEF-Message version="1.0" xmlns:idmef=" http://iana.org/idmef"> > <idmef:Alert messageid="abc123456789"> > <idmef:Analyzer analyzerid="bcfs"> > <idmef:Node category="dns"> > <idmef:name>bhushan</idmef:name> > </idmef:Node> > </idmef:Analyzer> > </idmef:Alert> > </idmef:IDMEF-Message> > > > when i run conversion code i am not getting converted > string it shows on following > > <?xml version=" 1.0"?> > > Plz tell wat mistake that i have made in above XSL file .. at first glance everything looks fine, I would * does your $color return anything, sometimes namespaces can be a bit confusing * did u try a simple example, lets say <name>bhushan</name> I would be interested in hearing your results. gl, Jim Fuller