Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
generating HTML page using workflow
vinylrecord
hi
i m trying to write a workflow in which i m generating HTML pages using iwpt_compile command. wft file is attached with this post.
this code works fine but the problem with this code is that the name of the files(presentation,dcr and output) is hardcoded. so every time i execute this workflow same file is generated.
can i have a generic version of this workflow. so that when a workflow is instantiated on saving a DCR. it takes as parameters dynamically the names of respective TPL, DCR and output files.
moreover where to specify the output file name.
if possible, reply ASAP
Find more posts tagged with
Comments
Bowker
That is possible.
insert a TAG_info( ... ) section into the .wft that prompts for the information you need (DCR, OUTPUTNAME, PTL...)
modify your command to use $xxxxx instead of hard coded names. - or use __TAG__('xxxxx') within the 'command' line.
Migrateduser
Can you have your code read templating.cfg to see what presentation templates are associated with the category/type of the DCR and generate pages using that configuration? I usually add an autogen="t" to each presentation template in templating.cfg to indicate which should be used to automatically generate output files. I have examples in C# and Java if you are interested, but parsing XML with Perl is not too hard either. Use the extended attributes on the DCR to determine the category and type and set up XPath queries based on that, then generate to the directory under the workarea that corresponds to the directory the DCR is in (for instance /templatedata/category/type/data/directory1/directory2/dcr would generate /directory1/directory2/dcr.extension).
Seems like it should come with the product...
TableRowTypes.PNG
vinylrecord
Hi,
i don't want to actually prompt user to provide names and location of DCR and TPLs.
In our TPL we had used command line arguments to actually find out TPL n DCR's full path. We wud like to do something like that without prompting user.
It could be some variable( probably environment) which is set to DCR and TPL full path as soon as any job is instantiated.
Thanks
vinylrecord
Hi John
could u please elaborate on the usage of extended attributes to find out category n type of a DCR.It would be a gr8 help if u cud provide pointers as to where i can get details on how to actually use extended attributes.
Thanks
Migrateduser
Use the command line as follows:
iwextattr -g "TeamSite/Templating/PrimaryDocumentType" full-path-to-dcr
Confirm that it returns a value and not an error message (do nothing if it returns an error message - that indicates that the file is not templated).
It will give you the category/type of the file, so split it into two variables/properties. Then use those to create the XPath query into templating.cfg. In Java it looks something like:
Hashtable collTemplatingConfig = new Hashtable();
DocumentBuilderFactory objDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
objDocumentBuilderFactory.setNamespaceAware( true );
objDocumentBuilderFactory.setValidating( false );
Document objDocument = objDocumentBuilderFactory.newDocumentBuilder().parse( new File( IWConstants.TEMPLATING_CONFIG ));
String strXPathQuery = "/templating/category[
@name=
'" + this.getTemplatingCategory() + "']/data-type[
@name=
'" + this.getTemplatingType() + "']/presentation/template[
@autogen=
't']";
NodeIterator objNodeIterator = XPathAPI.selectNodeIterator( objDocument, strXPathQuery );
Node objNode;
while (( objNode = objNodeIterator.nextNode()) != null )
{
collTemplatingConfig.put( objNode.getAttributes().getNamedItem( "extension" ).getNodeValue(), objNode.getAttributes().getNamedItem( "name" ).getNodeValue());
}
The hashtable maps the extensions to the presentation templates that would be used to generate them.