ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> exslt
exslt
Re: [exslt] Abt Libxslt use in replace function
by James Fuller other posts by this author
Sep 19 2006 12:35AM messages near this date
[exslt] Abt Libxslt use in replace function | Re: [exslt] Abt Libxslt use in replace function
& XSLT 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

_______________________________________________
exslt mailing list
list@[...].org
http://www.exslt.org/list
Thread:
Bhushan
James Fuller
James Fuller

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved