How to design conditional content control using OpenDoPE add-in - xpath

Iam using OpenDoPE add-in(First/Old version), I have a table design like follows
I have an xml data like follows
<myxml>
<rows>
<row>
<name>Abhilash Shajan</name>
<company>Standout</company>
<designation>Developer</designation>
<age>20</age>
</row>
<row>
<name>Sam Thomas</name>
<company>Allianze</company>
<designation>Tester</designation>
<age>27</age>
</row>
<row>
<name>Pradhap</name>
<company>UST</company>
<designation>SQL developer</designation>
<age>26</age>
</row>
<row>
<name>Ragesh</name>
<company>IBS</company>
<designation>Tester</designation>
<age>22</age>
</row>
</rows>
</myxml>
I need to apply condition to my repeating content control(here the row node is the repeating content control). Here is my condition, If age is greater than 25 then that row should not be visible.
How to write this condition in my OpenDoPE task pane.
Iam a beginner to this add-in can someone help me?

The conditional content control should be wrapped around (ie contain) the row, and the repeat content control should be wrapped around the conditional content control.
You might find it easier to first add the conditional content control, then add the repeat content control.

Related

XPATH exclude more than one element/tag

I am having issues trying to extract text between two div tags in an XML.
Imagine I have the following XML:
<div class="default_style_wrap" >
<!-- Body starts -->
<!-- Irrelvent Data -->
<div style="clear:both" />
<!-- Irrelvent Data -->
<div class="name_address" >...</div>
<!-- Irrelvent Data -->
<div style="clear:both" />
<!-- Irrelvent Data -->
<span class="img_comments_right" >...</span>
<!-- Text that I want to get -->
Two members of the Expedition 35 crew wrapped up a 6-hour, 38 minute spacewalk at 4:41 p.m. EDT Friday to deploy and retrieve several science experiments on the exterior of the International Space Station and install a new navigational aid.
<br />
<br />
The spacewalkers' first task was to install the Obstanovka experiment on the station's Zvezda service module. Obstanovka will study plasma waves and the effect of space weather on Earth's ionosphere.
<!-- Irrelvent Data Again -->
<span class="img_comments_right" >...</span>
<!-- Text that I want to get -->
After deploying a pair of sensor booms for Obstanovka, Vinogradov and Romanenko retrieved the Biorisk experiment from the exterior of Pirs. The Biorisk experiment studied the effect of microbes on spacecraft structures.
<br />
<br />
This was the 167th spacewalk in support of space station assembly and maintenance, totaling 1,055 hours, 39 minutes. Vinogradov's seven spacewalks total 38 hours, 25 minutes. Romanenko completed his first spacewalk.
<!-- Body ends -->
</div>
As it may not be reflective in the code, default_style_wrap is the parent of all those other irrelevant divs and spans. The relevant text to me is basically all of the tag-less text but as there are other tags in between as you can see, for instance img_comments_right, it is driving me nuts.
I tried the following as I saw in another post:
"//div[#class='article_container']/*[not(self::div)]";
but that seems not be returning any text at all, and even if it did, I wouldn't know how to also exclude the spans.
Any ideas?
Solution:
You can use or operator for specifying multiple conditions for not operator
Like so:
not(expr1 or expr2)
Thus you can add self::span as another condition for not to exclude them from result ;
//div[#class='default_style_wrap']/*[not(self::div or self::span)]
PS: There seems to be issue with improper closing of div tags. Close them in a proper way.
You should try the following query. It selects all following siblings of the <span> nodes, which are text nodes:
query = '//span[#class="img_comments_right"]/following-sibling::text()';
You can use this xpath:
//div[#class='default_style_wrap']/text()
You should be able to grab the text, using this XPath:
div[#class = 'default_style_wrap']/text()[normalize-space()]
It selects all text() nodes that are children of the *default_style_wrap* <div>, filtering empty (or whitespace-only) nodes out.
If you use a separate template, you can put each chunk neatly in its own paragraph, e.g.:
<xsl:template match="/">
<xsl:apply-templates select="div[#class = 'default_style_wrap']/text()[normalize-space()]" />
</xsl:template>
<xsl:template match="text()">
<p><xsl:value-of select="." /></p>
</xsl:template>

Devexpress Gridview Filter Control

I have a ASPxGridView component that is filled from a SQL query
I wanted to apply a filter on my ASPX Gridview
so I wrote:
<dx:ASPxGridView runat="server" ID="gvExecReq" Visible="false" AutoGenerateColumns="true"
OnPageIndexChanged="gvExecReq_PageIndexChanged" OnBeforeColumnSortingGrouping="gvExecReq_BeforeColumnSortingGrouping">
**<Settings ShowFilterRow="True" />
<Settings ShowFilterBar="Visible" ShowHeaderFilterButton="True" />**
</dx:ASPxGridView>
the filter is well established, but it is not functional
What do I need to add more?
Please Use Following Settings For Filter To Be Operational :
<Settings ShowHeaderFilterButton="true"
EnableFilterControlPopupMenuScrolling="True"
ShowFilterBar="Visible" ShowFilterRow="True" ShowFilterRowMenu="True" />
Also In The Columns of The Grid You Can Control The Condition of Filtering i.e. Contains, Equal, Does Not Contain etc.
<dx:GridViewDataColumn Settings-AutoFilterCondition="Contains" Settings-FilterMode="DisplayText">
if in the database filed type is string you can write part of text for search,but is type of int or decimal or so on,you should write ALL text even it can find rows

How to order Excel Export multi Worksheet XML

The Magento orders Export mechanism built-in does not export goods orders
I would like to ask you how to export each order on a Worksheet Worksheet within each piece of data is a commodity information
The following are examples
<Workbook>
<Worksheet ss:Name="order1">
<Table>
<Row>
<Cell><Data ss:Type="String">Order #</Data></Cell>
<Cell><Data ss:Type="String">SKU</Data></Cell>
<Cell><Data ss:Type="String">Qty</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="Number">1</Data></Cell>
<Cell><Data ss:Type="String">A1</Data></Cell>
<Cell><Data ss:Type="Number">3</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="Number">1</Data></Cell>
<Cell><Data ss:Type="String">A2</Data></Cell>
<Cell><Data ss:Type="Number">5</Data></Cell>
</Row>
</Table>
</Worksheet>
<Worksheet ss:Name="order2">
<Table>
<Row>
<Cell><Data ss:Type="String">Order #</Data></Cell>
<Cell><Data ss:Type="String">SKU</Data></Cell>
<Cell><Data ss:Type="String">Qty</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="Number">2</Data></Cell>
<Cell><Data ss:Type="String">B1</Data></Cell>
<Cell><Data ss:Type="Number">2</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="Number">2</Data></Cell>
<Cell><Data ss:Type="String">B2</Data></Cell>
<Cell><Data ss:Type="Number">3</Data></Cell>
</Row>
</Table>
</Worksheet>
Through the the understanding lib/Varien/Convert/Parser/Xml/Excel.php, Magento itself does not support multi Worksheet Export
I plan to write another one Parser, do multi-Worksheet Export.
But the bigger issue, export the data needs through
app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php the _prepareColumns () processing
But I can not find how to call database
I hope we can help, thank you
You can drop the PHPExcel library in 'lib' and Magento will autoload it without further ado in your module (You'll be needing a custom module).
Since you are writing rather than reading you should be able to work with PHPExcel within your existing memory (importing with PHPExcel can be huge).
There are no limits on what you can do with the fine control of PHPExcel, obviously you'll need to iterate your orders too and your module will need a back end.
You can put together a skeleton module, see if you can create a EXcel file (pop some of the demo code in and see if it picks up the classes etc). Then you should be able to export great reports once you have those bits working.
http://phpexcel.codeplex.com/
https://stackoverflow.com/a/4816738/1617149

how to display an image using xslt

I have the following code
<xsl:template name="toggle">
<xsl:param name="target"/>
<xsl:param name="show"/>
<input type="image" src="glass.png" />
<xsl:attribute name="onclick">
toggle('<xsl:value-of select="$target"/>','<xsl:value-of select="$show"/>');
</xsl:attribute>
</input>
</xsl:template>
I want to add an external image which is not part of xml file. I want to replace my Submit button with an image.
When using the above code I am unable to get the image as output.
Any ideas on how to do it?
Do you know what HTML you want to generate?
If you do, then tell us.
If you don't, then you have an HTML problem, not an XSLT problem.
Never try to write code in XSLT until you know what output HTML you want it to produce. Actually, I think it was Dijkstra who said you should never start writing any program until you know what output you want it to produce. A good principle. When applied to XSLT, remember that the output in this sense is an HTML document, not a screen displayed by the browser.

Customize a document_view and add a div?

This feels like a newbie question but:
I am trying to create a new page from the drop-down display menu so that I can supply a background color to the page (so end user doesn't have to go into the html and add a div). I tried adding a new (empty) div to the template but it's not working. Is this even possible?
Here is my code (my div is called "s_holder"):
<metal:field use-macro="python:here.widget('text', mode='view')">
Body text
</metal:field>
<div metal:use-macro="here/document_relateditems/macros/relatedItems">
show related items if they exist
</div>
<div tal:replace="structure provider:plone.belowcontentbody" />
</tal:main-macro>
</metal:main>
<div id="s_holder"></div><!--end s holder-->
</body>
</html>
For the part of creating the new display view: as #Auspex said, you should put the div inside the macro.
To add your display view to the drop down menu you need to edit every content type. There are two ways of doing this:
1- manually add a "types" folder in the genericsetup profile of your product and put inside one xml file per content type. Ex:
File.xml
<?xml version="1.0"?>
<object name="File"
meta_type="Factory-based Type Information with dynamic views"
i18n:domain="plone" xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<property name="view_methods">
<element value="file_view"/>
<element value="myniewfantastic_view"/>
</property>
</object>
2- in the ZMI -> portal_types edit every content type to add your display view and then in the portal_setup tool export the step for types. Extract the xml definitions from the downloaded archive to your genericsetup profile (in the "types" folder) and then edit them to remove unuseful parts as above.
Sure you can do it. I'm not convinced it's a good idea :-), but you need the <div> to be inside the main_macro (your example HTML is invalid - you have a </tal:main-macro> and no start tag, but I'm assuming you just cut and pasted the last part of the template here, because that template would never display, if it was written that way.
That said, how exactly are you adding it to "the drop-down display menu"?

Resources