cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Stylesheet error: "Prefix 'child' not declared"

jsage
1-Newbie

Stylesheet error: "Prefix 'child' not declared"

A user reported an issue when trying to insert a graphic using a FIG tag. The exact scenario is shown here. The user has inserted a graphic using FIG and TITLE. Our Fig element logic looks for: if fig in procinfo, else if fig in li, else fig everywhere else.

I also included what I believe is the result of that logic, the specific XPATH language in use for this situation, "Fig Everywhere Else". The error does not seem to actually affect anything since the user can still create the topic, use in publication structures, etc, but we are worried that it may be a bigger issue down the road. I am relatively new to Styler, and I am not sure what to even check for to start debugging this issue. Help!

The actual error reads:

Cannot evaluate XPath expression in stylesheet [A30282] Invalid XPath expression: The prefix 'child' is not declared. Element: fig: Xpath expression: (not(Child:title/text()))

Child error.jpg

Xpath expression.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
ClayHelberg
17-Peridot
(To:jsage)

Hi Jackie--

There's an error in your XPath expression. You are missing a colon, so the interpreter thinks you mean "child" as a namespace prefix instead of an axis specifier. To fix it, change the condition to read:

     not(child::title/text())

(Note there are two colons there.)

--Clay

View solution in original post

3 REPLIES 3
ClayHelberg
17-Peridot
(To:jsage)

Hi Jackie--

There's an error in your XPath expression. You are missing a colon, so the interpreter thinks you mean "child" as a namespace prefix instead of an axis specifier. To fix it, change the condition to read:

     not(child::title/text())

(Note there are two colons there.)

--Clay

Clay is 100% correct. It is also worth noting that the child:: axis is the default for unqualified element names in XPath, meaning you can substitute "not(title/text())" and get the same result.

BTW it is actually very unusual to see child:: in XPath expressions as it can make them unwieldy (e.g. /child::doc/child::chapter/child::section/child::para as opposed to /doc/chapter/section/para).

Thank you! I made the first suggested change for now and will see how that goes once it is in place in the PE. But I noted your comment for future improvements. I inherited another's work and am a relative newbie with the stylesheets, so I appreciate that pearl of wisdom!

Top Tags