Re: How to use XPath expression in Edit APP source in _ufe element?

Hi Gareth,

Followed Jana's instructions to create the .3d file, thank you Jana, and I did poke around with the file looking for all (1657) fdt "name" that could resemble anything close to a stream name but with no success.

However, poking around I found something that caught my eye, namely this lines

$template.primaryStream = 'editorDom0';

$application.variables['_x_primaryStream'] = 'editorDom0';

under the following fdt line, fdt "autoexec",90,"",0,"";;4.

I have tried all the following with no success:

formatting.evaluateXPath("count(editorDom0#//doc")

formatting.evaluateXPath("count(editorDom0#/doc")

formatting.evaluateXPath("count(editorDom0//doc")

formatting.evaluateXPath("count(editorDom0/doc")

and that made me think that editorDom0 is not the main stream I am looking for.

I still want to get this solution working because more direct (1 step deal) than the second solution which uses two step process. Like I said #1 work just fine.

Re: How to use XPath expression in Edit APP source in _ufe element?

You're correct it is "editorDom0" that is the main stream for Styler-generated the .3D files. I had forgotten. I tested in a standalone .3D file and the syntax formatting.evaluateXPath("editorDom0#/doc"); is the correct one. Perhaps you should raise this with PTC support for further assistance.

1. I have tried "editorDom#/your/XPath/expression/here" with one forward slash instead of two forward slashes in the XPath expression and did not work. I know, I know... PTC recommends not to use double forward slashes in a XPath expression because slows down the process, and I kind of agree with that, but this is my finding for now. Gareth, any input?

2. Another finding is that the above expressions won't give the expected result without the second parameter "1if1", which to be honest I do not know what it means and/or what it does. Gareth, any input? So do not forget to add "1if1" as a second parameter for evaluateXPath() function. I have looked up in PTC Help, and evaluateXPath() function in fFormatting interface takes only an expressionparameter, not two.

Thank you again Gareth and Jana to help me get this much more elegant solution to work.

Re: How to use XPath expression in Edit APP source in _ufe element?

1. I think the problem is that what you're styling isn't what you expect. Note in that PTC Article there is a /RDStyle/... in the path, that is why you need double-slash so it navigates past that extra element. The problem with // is that it will slow your publishing down - it forces APP to visit every node in the entire document each time that XPath is evaluated.

2. I have no idea about "1if1", this is the first time I've ever seen that syntax.