*/
public static Element createObject4(XMLSignature sig) throws Exception {
Document doc = sig.getElement().getOwnerDocument();
String BaseURI = sig.getBaseURI();
Manifest manifest = new Manifest(doc);
manifest.addResourceResolver(new OfflineResolver());
manifest.setId("manifest-1");
manifest.addDocument(BaseURI, "http://www.w3.org/TR/xml-stylesheet",
null, Constants.ALGO_ID_DIGEST_SHA1,
"manifest-reference-1", null);
manifest.addDocument(BaseURI, "#reference-1", null,
Constants.ALGO_ID_DIGEST_SHA1, null,
"http://www.w3.org/2000/09/xmldsig#Reference");
//J-
String xslt = ""
+ "<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'\n"
+ " xmlns='http://www.w3.org/TR/xhtml1/strict' \n"
+ " exclude-result-prefixes='foo' \n"
+ " version='1.0'>\n"
+ " <xsl:output encoding='UTF-8' \n"
+ " indent='no' \n"
+ " method='xml' />\n"
+ " <xsl:template match='/'>\n"
+ " <html>\n"
+ " <head>\n"
+ " <title>Notaries</title>\n"
+ " </head>\n"
+ " <body>\n"
+ " <table>\n"
+ " <xsl:for-each select='Notaries/Notary'>\n"
+ " <tr>\n"
+ " <th>\n"
+ " <xsl:value-of select='@name' />\n"
+ " </th>\n"
+ " </tr>\n"
+ " </xsl:for-each>\n"
+ " </table>\n"
+ " </body>\n"
+ " </html>\n"
+ " </xsl:template>\n"
+ "</xsl:stylesheet>\n"
;
//J+
javax.xml.parsers.DocumentBuilderFactory dbf =
javax.xml.parsers.DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
org.w3c.dom.Document docxslt =
db.parse(new ByteArrayInputStream(xslt.getBytes()));
Node xslElem = docxslt.getDocumentElement();
Node xslElemImported = doc.importNode(xslElem, true);
Transforms transforms = new Transforms(doc);
transforms.addTransform(Transforms.TRANSFORM_XSLT,
(Element) xslElemImported);
manifest.addDocument(BaseURI, "#notaries", transforms,
Constants.ALGO_ID_DIGEST_SHA1, null, null);
manifest.generateDigestValues();
return manifest.getElement();
}