}
// all the parameters are set up, fire up structure transformation
// filter to fill in channel/folder attributes for the "structure" transformation.
StructureAttributesIncorporationFilter saif = new StructureAttributesIncorporationFilter(ssth,
userPreferences.getStructureStylesheetUserPreferences());
// This is a debug statement that will print out XML incoming to the
// structure transformation to a log file serializer to a printstream
StringWriter dbwr1 = null;
OutputFormat outputFormat = null;
if (logXMLBeforeStructureTransformation && log.isDebugEnabled()) {
dbwr1 = new StringWriter();
outputFormat = new OutputFormat();
outputFormat.setIndenting(true);
XMLSerializer dbser1 = new XMLSerializer(dbwr1, outputFormat);
SAX2DuplicatingFilterImpl dupl1 = new SAX2DuplicatingFilterImpl(ssth, dbser1);
dupl1.setParent(saif);
}
// if operating in the detach mode, need wrap everything
// in a document node and a <layout_fragment> node
boolean detachMode = !rootNodeId.equals(UPFileSpec.USER_LAYOUT_ROOT_NODE);
if (detachMode) {
saif.startDocument();
saif.startElement("",
"layout_fragment",
"layout_fragment",
new org.xml.sax.helpers.AttributesImpl());
// emptyt.transform(new DOMSource(rElement),new SAXResult(new ChannelSAXStreamFilter((ContentHandler)saif)));
if (rElement == null) {
ulm.getUserLayout(new ChannelSAXStreamFilter((ContentHandler) saif));
}
else {
ulm.getUserLayout(rElement.getId(), new ChannelSAXStreamFilter((ContentHandler) saif));
}
saif.endElement("", "layout_fragment", "layout_fragment");
saif.endDocument();
}
else {
if (rElement == null) {
ulm.getUserLayout(saif);
}