You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by "Rowan Mountford XXX (TN/PAC)" <ro...@ericsson.com> on 2003/07/31 15:59:14 UTC

XSL Transform within

Hi all
 
Thanks for the assistance on my previous post. Its got me to where I am now.
 
I am curious, however, about applying an XSL transform within the <Reference> element and its execution within Java and Apache's XML Digital Signatures implementation. In xmldsig the transform output contains <element> tag's along with the associated data but if I apply the same transform within XML Spy I don't get the tags. Is there a reason for this? Because of this behaviour the <Reference><DigestValue> value differs from the original documents value and fails validation. Is it correct or am I missing something?
 
Eg:
...
<xsl:template match="/*/ds:Signature//*" />
<xsl:template match="/*/SignedElement//*" name="xsltemp" >
  <xsl:for-each select="*">
    <xsl:choose>
      <xsl:when test="count(child::*)=0 and count (@SEGMENT)=0">
        <xsl:copy-of select="." />
      </xsl:when>
      <xsl:otherwise>
       <xsl:call-template name="xsltemp" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:template>
 
XML Spy output:
ABC1234.56ABC0123456
 
Transform class output (from which a reference digest value is calculated):
<Elem1>ABC</Elem1><Elem2>1234.56</Elem2><Elem3><Elem4>ABC</Elem4><Elem5>0123456</Elem5></Elem3>
 
Thanks in advance
/r0

Re: XSL Transform within

Posted by zedar <ze...@op.pl>.
Hi,
Please provide your source XML file and full XSL transformation. Whats is the <xsl:output> tag?
I don't know what XMLSpy does but the result from the xmldsig looks much better for me.
My suggestion is to check what encoding you should use before passing data to calculate DigestValue.
In my project with digital signature I encountered many problems with encoding, mainly in situations when digestvalue or signatures were generated on the windows platform.

/zedar
  ----- Original Message ----- 
  From: Rowan Mountford XXX (TN/PAC) 
  To: security-dev@xml.apache.org 
  Sent: Thursday, July 31, 2003 3:59 PM
  Subject: XSL Transform within <Reference>


  Hi all

   

  Thanks for the assistance on my previous post. Its got me to where I am now.

   

  I am curious, however, about applying an XSL transform within the <Reference> element and its execution within Java and Apache's XML Digital Signatures implementation. In xmldsig the transform output contains <element> tag's along with the associated data but if I apply the same transform within XML Spy I don't get the tags. Is there a reason for this? Because of this behaviour the <Reference><DigestValue> value differs from the original documents value and fails validation. Is it correct or am I missing something?

   

  Eg:

  ...

  <xsl:template match="/*/ds:Signature//*" />

  <xsl:template match="/*/SignedElement//*" name="xsltemp" >

    <xsl:for-each select="*">

      <xsl:choose>

        <xsl:when test="count(child::*)=0 and count (@SEGMENT)=0">

          <xsl:copy-of select="." />

        </xsl:when>

        <xsl:otherwise>

         <xsl:call-template name="xsltemp" />

        </xsl:otherwise>

      </xsl:choose>

    </xsl:for-each>

  </xsl:template>

   

  XML Spy output:

  ABC1234.56ABC0123456

   

  Transform class output (from which a reference digest value is calculated):

  <Elem1>ABC</Elem1><Elem2>1234.56</Elem2><Elem3><Elem4>ABC</Elem4><Elem5>0123456</Elem5></Elem3>

   

  Thanks in advance

  /r0