[xmlsec] Problem with xmlSecTransformXsltAdd

Ulrich.Wimboeck at de.gi-de.com Ulrich.Wimboeck at de.gi-de.com
Mon Feb 24 09:37:03 PST 2003




Hi,

now I have an xslt script which removes white characters caused by pretty
prints (e.g. added by XML Spy).
The Script is tested and looks like:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" version="1.0" encoding="UTF-8"
omit-xml-declaration="no" indent="no" />
  <!--xsl:preserve-space elements="UserComment "/-->
  <xsl:strip-space elements="*"/>
  <xsl:template match="/">
     <xsl:copy-of select="/"/>
  </xsl:template>
</xsl:stylesheet>

Now I want to add the script to the signature node (transform):

  xmlNodePtr cur = xmlSecReferenceAddTransform(referenceNode,
xmlSecTransformXslt) ;
    if(cur == NULL) {
      throw std::exception("") ;
    }

    int ret = xmlSecTransformXsltAdd(cur, BAD_CAST"<xsl:stylesheet
version=\"1.0\"
xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:output
method=\"xml\" version=\"1.0\" encoding=\"UTF-8\"
omit-xml-declaration=\"no\" indent=\"no\" /><xsl:strip-space
elements=\"*\"/><xsl:template match=\"/\"><xsl:copy-of
select=\"/\"/></xsl:template></xsl:stylesheet>") ;

When I call the xmlSecDSigGenerate function the following error is printed.
The problem is that the < and > characters
are replaced by their xml escape sequences. How can I resolve this problem?

Entity: line 1: error: Start tag expected, '<' not found
&lt;xsl:stylesheet version=&quot;1.0&quot;
xmlns:xsl=&quot;http://www.w3.org/19
^
compilation error
xsltParseStylesheetProcess : empty stylesheet
 (d:\xmlsec own built\xmlsec-0.0.12\src\xslt.c:428): error 5: xslt
operation fai
led : xsltParseStylesheetDoc
 (d:\xmlsec own built\xmlsec-0.0.12\src\xslt.c:304): error 2: xmlsec
operation f
ailed : xmlSecTransformXsltExecute - -1
 (d:\xmlsec own built\xmlsec-0.0.12\src\transforms.c:1416): error 4: xml
operati
on failed : xmlOutputBufferClose
 (d:\xmlsec own built\xmlsec-0.0.12\src\transforms.c:1319): error 2: xmlsec
oper
ation failed : xmlSecTransformCreateBinFromXml or
xmlSecTransformCreateBinFromUr
i - -1
 (d:\xmlsec own built\xmlsec-0.0.12\src\transforms.c:1273): error 2: xmlsec
oper
ation failed : xmlSecTransformCreateBin - -1
 (d:\xmlsec own built\xmlsec-0.0.12\src\transforms.c:965): error 2: xmlsec
opera
tion failed : xmlSecTransformCreateXml - -1
 (d:\xmlsec own built\xmlsec-0.0.12\src\transforms.c:195): error 2: xmlsec
opera
tion failed : xmlSecTransformStateUpdate
 (d:\xmlsec own built\xmlsec-0.0.12\src\xmldsig.c:1612): error 2: xmlsec
operati
on failed : xmlSecTransformsNodeRead - -1
 (d:\xmlsec own built\xmlsec-0.0.12\src\xmldsig.c:1476): error 2: xmlsec
operati
on failed : xmlSecReferenceRead - -1
 (d:\xmlsec own built\xmlsec-0.0.12\src\xmldsig.c:1175): error 2: xmlsec
operati
on failed : xmlSecSignedInfoRead - -1
 (d:\xmlsec own built\xmlsec-0.0.12\src\xmldsig.c:796): error 2: xmlsec
operatio
n failed : xmlSecSignatureRead - -1




More information about the xmlsec mailing list