Subject: Re: [xsl] Running xsltproc does not produce any output From: "ohaya ohaya@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 23 Jul 2024 21:47:22 -0000 |
Hi, I think I spoke too soon. I've been trying to modify the original example below, which uses the $input variable that gets set from the stringparam on the xsltproc command line, to populate the before-tab and after-tab vars, to work with the incoming XML, auditrecord.xml, but I don't quite know how to populate the vars from just the incoming request?B I think that structurally, I need something like: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:variable name="before-tab" select=" substring-before( substring-after($input, '='), '[Tab]' ) " />B B <<<< I'm not sure how to set these vars, since there is no $input.... <xsl:variable name="after-tab" select=" substring-before( substring-after($input, '[Tab]'), ';') " /> <!-- Identity transform to copy everything except <ExtraDetails> --> <xsl:template match="@*|node()"> B B B <xsl:copy> B B B B B <xsl:apply-templates select="@*|node()" /> B B B </xsl:copy> </xsl:template> <xsl:template match="/syslog/audit_record/ExtraDetails"> <ExtraDetails> <xsl:choose>B B B B B B B B B B B B B B B B B B B B B B B B B B B B <xsl:when test="string-length($before-tab) = string-length($after-tab)"> B B B B B B B <xsl:copy>B B B B B B B B B B B B B B B B B B B B B B B B B B B <<<<<<<<<<<<<<<< This is not correct... will need to modify the original <ExtraDetails> line B B B B B B B B B B B B B B B <xsl:value-of select="." /> B B B B B B B </xsl:copy> B B B </xsl:when> B B B <xsl:otherwise>B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B <<<<<<<<<<<<< I think that this part is all right, i.e., if the string lengths don't match, just pass the original <ExtraDetails> B B B B B B B <xsl:copy> B B B B B B B B B B B B B B B <xsl:value-of select="." /> B B B B B B B </xsl:copy> B B B </xsl:otherwise> </xsl:choose> </ExtraDetails> </xsl:template> </xsl:stylesheet> Can someone help with the above?B Thanks,Jim On Tuesday, July 23, 2024 at 12:52:23 PM EDT, ohaya <ohaya@xxxxxxxxx> wrote: Liam, I was able to get your suggested code working with xsltproc.. actually I kind of "enhanced" it a bit... <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="input"/> <xsl:variable name="before-tab" select=" substring-before( substring-after($input, '='), '[Tab]' ) " /> <xsl:variable name="after-tab" select=" substring-before( substring-after($input, '[Tab]'), ';') " /> <xsl:template match="/syslog"> <xsl:choose> B B B <xsl:when test="string-length($before-tab) = string-length($after-tab)"> B B B B B B B <xsl:message>The string-lengths of the string in front of, and after, the [Tab] are THE SAME</xsl:message> B B B B B B B <xsl:message> B B B B B B B B B B B B B B B before: <xsl:value-of select="$before-tab" />, B B B B B B B B B B B B B B B after: <xsl:value-of select="$after-tab" />. B B B B B B B </xsl:message> B B B </xsl:when> B B B <xsl:otherwise> B B B B B B B <xsl:message>The string-lengths of the string in front of, and after, the [Tab] are NOT THE SAME</xsl:message> B B B B B B B <xsl:message> B B B B B B B B B B B B B B B before: <xsl:value-of select="$before-tab" />, B B B B B B B B B B B B B B B after: <xsl:value-of select="$after-tab" />. B B B B B B B </xsl:message> B B B </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> and I test with xsltproc: xsltproc -o foo --stringparam input 'Command=Password$[Tab]Password$;' initialparsetest.xsl auditrecord.xml and: xsltproc -o foo --stringparam input 'Command=Password$[TabXXXXX]Password$;' initialparsetest.xsl auditrecord.xml I am going to make a new post/thread about how I want to go forward after this. Thanks! Jim
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Running xsltproc does not, Piez, Wendell A. (Fe | Thread | Re: [xsl] Running xsltproc does not, Liam R. E. Quin liam |
Re: [xsl] Running xsltproc does not, Liam R. E. Quin liam | Date | Re: [xsl] Running xsltproc does not, Liam R. E. Quin liam |
Month |