KeyMatch not working - google-search-appliance

I have inherited a GSA installation (with no handover notes or instructions, just the manuals). I am trying to enable some features on the test appliance. I have setup some KeyMatch "ExactMatch" items, but when I search for the trigger terms the KeyMatch results do not appear.
I changed the show_keymatch to "1" in the XSLT and saved it (it was set to "0"). Here is that section of the XSLT as it appears now:
<!-- *** keymatch suggestions *** -->
<xsl:variable name="show_keymatch">1</xsl:variable>
<xsl:variable name="keymatch_text">KeyMatch</xsl:variable>
<xsl:variable name="keymatch_text_color">#2255aa</xsl:variable>
<xsl:variable name="keymatch_bg_color">#e8e8ff</xsl:variable>
Is there another area in the XSLT file, or in the admin interface, that I need to look at in order to enable keymatch?
I feel that I have followed all the instructions in the docs, but the lack of results tell me that I've missed something!
Any advice greatly appreciated.

It is always possible that the previous developer modified the XSLT and took out the code to display it or your search URL may not be using those keymatches.
Two things:
1) I recommend to create a new Front End and put your keymatches in there and test with that Front End.
2) In your search URL are proxystylesheet and client the same values? If not, make sure they are the same and pointing to the Front End that contains the keymatch entries.

Related

XPath fails because Namespace colon in Title

I'm generating an XML report, using the JDF standard for PDFs going into a printing workflow.
There are 3 "DPart" sections, and I can use an xPath query to recognize them, but I want to grab the "Separation" attribute of each "cip4:Part". I can also get a query to find that, but it does not distinguish between the multiple "DPart"s.
<DPart End="0" ID="0003" ParentRef="0002" Start="0">
<DPM>
<cip4:Root>
<cip4:Intent cip4:ProductType="ProductPart"/>
<cip4:Production>
<cip4:Resource>
<cip4:Part Separation="K1"/>
<cip4:Color cip4:ActualColorName="Black" cip4:ColorType="Normal">
</cip4:Resource>
<cip4:Resource>
<cip4:Part Separation="S1"/>**
<cip4:Color cip4:ActualColorName="Dieline" cip4:ColorType="Normal">
</cip4:Resource>
<cip4:Resource>
<cip4:ColorantControl ColorantOrder="K1 S1" ColorantParams="K1 S1"/>
</cip4:Resource>
<cip4:Resource>
<eg:InkCoverage>
<eg:InkCov eg:Mm2="0.000000" eg:Pct="0.000000" eg:Separation="K1"/>
<eg:InkCov eg:Mm2="182.337538" eg:Pct="0.721209" eg:Separation="S1"/>
</eg:InkCoverage>
</cip4:Resource>
</cip4:Production>
</cip4:Root>
</DPM>
</DPart>
I want to do something like:
/DPM[2]/*[name ()='cip4:Part'], but it's not working.
I'm in a low-code pre-press environment (Esko Automation Engine), but the system gives me tools to parse an xPath, and throw some JavaScript at it.
There are at least three reasons your XPath selects nothing:
DPM is not an immediate child of the root node
There is only one DPM, so DPM[2] won't select anything
There is no child of a DPM whose name is cip4:Part.
You also say in the narrative that there are three DPart's, which implies that DPart is not actually the outermost element as it appears to be in your sample. This makes it difficult to provide the correct XPath. However, you might be able to make a start with
(//DPM)[2]//*[name()='cip4:Part']

ms365 power automate online: how to get xml attribute values for a particular text value

I am looking to extract only the wow:rank values at which the text in between the > and < starts with BOOM-. I was able to get the text values in between the > and < that start with BOOM- using filters in power automate 365 online, but i just couldn't simultaneously get the wow:rank attribute values. Any help would be greatly appreciated!
<category wow:rank="0">EIGEGenderEquality</category>
<category wow:rank="9" >BOOM-A0304-DiscriminatoryPracticesOnTheBasisOfSex</category>
<category wow:rank="0">EIGEGenderEquality</category>
<category wow:rank="5" url = "www.google.ca">BOOM-EIGEGenderEquality</category>
Have a great day! :)
It looks as though the PowerAutomate xpath expression (coupled with xml) doesn't handle the extraction of attributes. It merely provides the ability to filter on all elements based on the given xquery expression provided.
In that case, you can use the below expression on each element within your XML to get your result ...
replace(split(split(variables('XML String'), 'wow:rank="')[1], '"')[0], '"', '')
... that was applied in the Initialize wow:rank step below.
Outside of that, you could make it a lot more complex by making an API call to a service that does it for you but it's potentially a lot more work and not really worth it.
If your scenario was more complex, then I'd look into doing that.
You can get to attributes easily by using the # symbol, like #wow:rank.
In a "Apply to each", you would use:
xpath(xml(item()), 'string(/category/#wow:rank)')
to loop through each of them.

Negative decimal value formatting in Altova Style Vision

I have a problem with value formatting in Altova StyleVision. Altova forums seem to be dead. Maybe someone encountered similar problem.
I have created an Auto Calculation inside XBRL table generated by StyleVision. It contains " sum( xbrli:xbrl/n1:Wages ) " xpath expression. This expression gives me a negative value. I want to format it so that it's surrounded by parentheses instead of leading minus.
I have tried using prefixes ans suffixes in "value formatting", like this (###,##0.##) or this [###,##0.##] . But I still get minus instead of parentheses. Is there a way to get around this? Any of those prefixes seem not to work for me at all.
http://manual.altova.com/Stylevision/stylevisionbasic/index.html?svpres_inputformatting.htm
Ok. It seems that problem is solved.
Created ch.xsl file with following contents:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:decimal-format name='ch' grouping-separator=" " decimal-separator=","/>
</xsl:stylesheet>
In Altova StyleVision under Design Overview -> Add new XSLT file. Choose ch.xsl.
Afterwards in Auto Calculation xpath used following expression:
format-number(sum( xbrli:xbrl/n1:Wages ),'### ##0,##;(### ##0,##)','ch')
Maybe there is a better way to do this, but it worked for me. Hope it will help someone

bpws:getVariableData() causes fault if no xpath match is found

I wanted to use "bpws:getVariableData()" to assign a value only if the xpath expression find a match. If not, nothing should happen. Unfortunately the bpel processing stops with a fault, if the xpath expression finds no match. Is there a way to achieve this behavior?
Thanks for your help.
I found that the oracle BPEL engine provides a feature to ignore missing from data. This Flag can be added to the copy element as follows:
<copy bpelx:ignoreMissingFromData="yes|no"/>
More info on how to set it in the JDeveloper: http://download.oracle.com/docs/cd/E17904_01/integration.1111/e10224/bp_manipdoc.htm#SOASE87087
This solves the problem with the fault message that is thrown. However it still does not show the wanted behavior. My intension was that no assignment is done, if the xpath expression cannot be evaluated. Using the bpelx:ignoreMissingFromData flag however assigns the empty string "" to the target.
In my use case I want to merge tow XML documents. I want to assign a new value to an element in document1 only if the element shows up in document2. If not, leave the element in document1 unchanged.
I solved the problem using a transformation instead of a BPEL assign. In the xsl I use the following statement. The transformation gets two XML documents a input. Document1 is referenced via the parameter $parameter_referenceDocument1.
<elementName>
<xsl:if test="xpathInDocument2">
<xsl:value-of select="xpathInDocument2"/>
</xsl:if>
<xsl:if test="not(xpathInDocument2)">
<xsl:value-of select="$parameter_referenceDocument1.xpathInDocument1"/>
</xsl:if>
</elementName>
I know its ugly, but solves the problem. If anyone has a better solution, please let me know.
No, the BPEL standard requires the engine to throw a selectionFailure in this case. To avoid such situations, make sure you have properly initialized variables and/or validate variable against a schema. Also you may guard an assign activity with an if/switch activity to check for the presence of the element before accessing it. You may also consider writing an custom XPath function that returns a default value in case the demanded element does not exist in the variable. However, I'm not sure if the Oracle BPEL engine supports that.
You can create a scope around the assign activity and using an exception handler on the scope catch the selectionFailure, the item which will then carry on processing.
In the exception handler you could then assign a default value if required.
To clarify Vanto's statement, the Oracle BPEL engine does support custom XPath functions which would allow you to do that.

How can I use XSL to run a template against a specific node that is located by an attribute?

For example, I'm trying to pick out the value "Application Library" from the following XML - ie, the value under content-node/localedata/title, where localedata#locale = "en".
<content-node objectid="6_NO2UF4I1186E1026H4BLVI08F1">
<localedata locale="de">
<title>Anwendungsbibliothek</title>
</localedata>
<localedata locale="en">
<title>Application Library</title>
</localedata>
<localedata locale="es">
<title>Biblioteca de aplicaciones</title>
</localedata>
</content-node>
Specifically, what XPath expression do I put in the xsl:template#match value? I think it should be something like this, except I don't know how to match for the hardcoded value "en":
<xsl:template match="localedata[#locale = en]">
Am I on the right track here, or is there some other way I should go about this?
I would say yes, you should be on the right track. I can't seem to find any samples to verify and confirm this - but you should have no trouble trying and verifying this.
I say : go for it!
Looks like you'll have to adapt your XSL just a tiny bit:
<xsl:template match="localedata[#locale='en']">
With this (remove spaces after #locale, put the value in ' ... ') everything should be fine.
Marc

Resources