Hi Florin, the .3d file you can create by these steps: from Styler menu - Preview - Print - and then from APP Preview window - File - Save APP File.
But despite Gareth's instruction I was not able to find the correct XML stream for the #2 solution, so I used the #1 one. Anyway I'm interested if you will be more successful. If so, post your method.
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:
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.
Am I looking at the wrong thing? Any other suggestion or tip?
Thank you for help!
Have a blessed day!
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.
After posting the previous post I kept poking around with the .3d file and I found the following peace of code (changes are obvious ) that confirms that editorDom0 is the main stream:
var florin = content.getStream(template.primaryStream);
application.alert("steram name: " + florin.name);
which produces the attached result.
Now that Gareth confirmed too that editorDom0 is the main stream I will try again to evaluate the XPath, and if does not work I will reach PTC like Gareth suggested.
Jana, you can also try it and see what results are you getting.
Thank you for help!
Hi Florin, here is one PTC Article concerning our thema :-)
They use this trick:
if ( formatting.evaluateXPath( "@xml:lang = 'ja'", "1if1" ) != 0 )
if ( formatting.evaluateXPath( "editorDom0#boolean( /RDStyle/ResolvedMap/shopmanualmap/@xml:lang = 'ja')", "1if1" ) != 0 )
Thank you for pointing me in the right direction. After I tried to see what makes sens for me from all that, I came up with following syntax that did work for me.
Looking for text() node:
Using an XPath function:
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 expression parameter, not two.
Thank you again Gareth and Jana to help me get this much more elegant solution to work.
Have a blessed day!
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.