What does this Apache FOP error mean? - pdf

Error message
(Location of error
unknown)org.apache.fop.fo.Validation
Exception: Property id "_Ref191196753"
previously used; id values must be
unique in document.
Any ideas on what may cause this? Is it because I have a for-each and apply the same template multiple times?

The specification states the id of an element must be unique.
The following code produces the error message you get.
<fo:block id="_Ref191196753"/>
<fo:block id="_Ref191196753"/>
You need to search your fo-file to locate the occurences of the elements with the same id. Then make changes in your XSLT to eliminate these.

Related

Referencing input value by name in HTMX

I've started looking into using HTMX recently and I've ran accross a problem that I can't figure out. Essentially I have a select element which I use to make an http POST whenever the user makes a selection. In order to make that post however, I need to provide a token which is stored in the input about the select. Is there a way for me to reference in HTMX syntax the input from above using it's name "csrfmiddlewaretoken"?
So I figured out what my trouble was. In order for me to expand the payload of the hx-post request, what I needed to do was include the HTML elements that I wanted the contents of in the hx-post request. To do that you can use the hx-include attribute on the request emiting element, which references other elements by name and takes their value in the payload as a {name: value} pair.
<select name="sample_select" hx-post="link" hx-include="[name='csrfmiddlewaretoken']" hx-trigger="changed">...
The example select above would issue an HTTP Post request when the value of the select element would be changed. The request payload would then be
{
sample_select: selected_value;
csrfmiddlewaretoken: value
}
Keep in mind that if you have multiple elements on the same page with the same name, when you reference the name in the hx-include attribute then the HTMX library will take all the values from all the elements in the payload. I have not found a way to reference a specific element, or the closest one yet but if you know of a way please share.

Using regex while finding web element by id in Selenium java

I am trying to locate web elements using the element id. But the id of the same web element changing between
Driver.findElement(By.id("ItemDetailsCompView.**Edit**ViewUIElement_Field_Tab_2_Product_Materials"))
and
Driver.findElement(By.id(ItemDetailsCompView.**Display**ViewUIElement_Field_Tab_2_Product_Materials"))
This results in to an error when I have hard coded for one id and the other id occurs. Is there a way to create a string that searches for Edit / Display words in the id.
I am unable to use Xpath as my webpage is complex and consists of various nested tables.
You could try using a CSS selector (the syntax may be incorrect here, it's not clear what language you are using):
Driver.findElement(By.CssSelector([id*="ViewUIElement_Field_Tab_2_Product_Materials"]))
Even better if you can provide an element tag name on that.

error in version change

When i'm using an XSLT statement for transforming and it is as below.
<xsl:when test="preceding-sibling::title/#num and contains(./item/#num,'•')">
when i'm using XSLT1.0 version there is no issue, but when i'm changing the version to 2.0, it is throwing the below error, please let me know how i can fix this.
XSLT 2.0 Debugging Error: Error: file:///C:/Users/u0138039/Desktop/Proview/MAL/Malaysian%20Civil%20Procedure%202013/XSLT/new_bull%20-%20Cols.xsl:704: Wrong occurrence to match required sequence type - Details: - XPTY0004: The supplied sequence ('4' item(s)) has the wrong occurrence to match the sequence type xs:string ('zero or one')
Try contains((./item/#num)[1],'•') to make sure there is only one node as the first argument to contains.
See http://www.w3.org/TR/xpath-functions/#func-contains, the specification indicates with fn:contains($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean that the first argument needs to be an empty sequence or a single item, the error message The supplied sequence ('4' item(s)) suggests that in your code ./item/#num selects four items.

xpath filter while parent node changes name

I am trying to get the value of a node from third party source. Part of the Xmlstructure has a node whose name changes between, point and framedPoint. how do I get the latitude value?? here is part of the xml, their are many levels to the xml so have shown the relevant area.
here node is called point
<tpegpointLocation xsi:type="TPEGSimplePoint">
<point xsi:type="TPEGJunction">
<pointCoordinates>
<latitude>54.894825</latitude>
</pointCoordinates>
</point>
</tpegpointLocation>
here framedPoint
<tpegpointLocation xsi:type="TPEGSimplePoint">
<framedPoint xsi:type="TPEGJunction">
<pointCoordinates>
<latitude>54.894825</latitude>
</pointCoordinates>
</framedPoint>
</tpegpointLocation>
Thanks, for any help
You could use asterisk as a wildcard in your xpath
/tpegpointLocation/*/pointCoordinates/latitude
The following XPath would do the job:
//tpegpointLocation//pointCoordinates/latitude
Which means:
//tpegpointLocation search for all <tpegpointLocation> elements in the XML file
The second //pointCoordinates means search for all <pointCoordinates> elements below <tpegpointLocation> regardless which elements are between them (one or more or different names
/latitude means get the <latitude> element below <pointCoordinates>
Please note that using // scans whole XML file. If you are able to change //tpegpointLocation it would be better and faster.

Relate PSVI GetSchemaInfo to the XSD Validation Error ValidationEventArgs.Message

I have a question about Microsoft's MSDN documentation for the Extenstions.GetSchemaInfo Method (XElement) for .Net framework 4.0.
I want to know if there's a way from within the
Private Sub DumpInvalidNodes(ByVal el As XElement)
If el.GetSchemaInfo.Validity <> XmlSchemaValidity.Valid Then
...
End If
End Sub
Code to get the ValidationEventArgs.Message for the invalid node. This example works fine when you have numbered XML nodes like in the example: GrandChild1, GrandChild2. You can tell which invalid node is producing the validation errors by site. But when you have XML without numbered nodes, e.g.
<Root>
<Child>
<GrandChild>AAA</GrandChild>
<GrandChild>ZZZ</GrandChild>
<GrandChild>ZZZ</GrandChild>
</Child>
</Root>
you get output that looks like this:
(1)Validating doc1 ...
(2)The 'GrandChild' element is invalid - The value 'ZZZ' is invalid according to its datatype 'GCType' - The Enumeration constraint failed.
(3)The 'GrandChild' element is invalid - The value 'ZZZ' is invalid according to its datatype 'GCType' - The Enumeration constraint failed.
(4)doc1 did not validate
(5)Invalid Element /Root
(6)Invalid Element /Root/Child
(7)Invalid Element /Root/Child/GrandChild
(8)Invalid Element /Root/Child/GrandChild
I wanted a way to tell that line (7) referred to the ErrorMessage in line (2).
I have an XML document that I'm running XSD validation against as this article shows and I wanted to parse the ValidationEventArgs.Message into a more user friendly message for complex data types. I'd like to do this in the DumpInvalidNodes() method because I have access to the invalid Node and can obtain other information from the node (like an ID) that the user can use to find and fix the validation problem.
The easiest way for you would be to modify the original code and instead of doing the node dumping after, do it in the validation handler; it'll give you the validation message and the node at the same time (simply cast the sender to an XObject and deal with it as you need).
For XML loaded from files or strings you could also use this MSDN article here. Additional hints to the user, such as line number and column position, could also be useful.