Skip to main content
Solved

XSLTPROC parser error


Forum|alt.badge.img+7

Hello,

 

I'm trying to fetch some informations about a given device with thhe API and I can't get it to work, can someone enlight me ?

Here's my stylesheet definition:

cat << EOF > /tmp/computer.xslt <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:for-each select="computer/general"> <xsl:value-of select="name"/> <xsl:text>,</xsl:text> <xsl:value-of select="serial_number"/> <xsl:text>,</xsl:text> <xsl:value-of select="site/name"/> <xsl:text>&#xa;</xsl:text> </xsl:for-each> </xsl:template> </xsl:stylesheet> EOF

 

And here's how I run it:

fetchDetails=$(curl -sk 'authorization: Basic HIDDEN' -H "Accept: application/xml" https://HIDDEN/JSSResource/computers/id/$jamfID | xsltproc /tmp/computer.xslt -) echo "$fetchDetails"

 

And however I try to tweak and change I always receive an epty output from my echo, and these as error message from the API call:

-:10: parser error : Opening and ending tag mismatch: br line 8 and p </p> ^ -:11: parser error : Opening and ending tag mismatch: p line 8 and body </body> ^ -:12: parser error : Opening and ending tag mismatch: body line 5 and html </html> ^ -:12: parser error : Premature end of data in tag html line 1 </html> ^ unable to parse -

 

It's already not helping because the errors are not directly linked to my stylesheet, but that "unable to parse -" is a real mystery.

 

Thanks in advance.

Best answer by ljcacioppo

I think you need a -H in front of your base64 authentication since that is a header. Can you try this:

fetchDetails=$(curl -sk -H 'authorization: Basic HIDDEN' -H "Accept: application/xml" https://HIDDEN/JSSResource/computers/id/$jamfID | xsltproc /tmp/computer.xslt -) echo "$fetchDetails"
View original
Did this topic help you find an answer to your question?

2 replies

ljcacioppo
Forum|alt.badge.img+17
  • Contributor
  • 183 replies
  • Answer
  • November 16, 2021

I think you need a -H in front of your base64 authentication since that is a header. Can you try this:

fetchDetails=$(curl -sk -H 'authorization: Basic HIDDEN' -H "Accept: application/xml" https://HIDDEN/JSSResource/computers/id/$jamfID | xsltproc /tmp/computer.xslt -) echo "$fetchDetails"

Forum|alt.badge.img+7
  • Author
  • Contributor
  • 31 replies
  • November 17, 2021
ljcacioppo wrote:

I think you need a -H in front of your base64 authentication since that is a header. Can you try this:

fetchDetails=$(curl -sk -H 'authorization: Basic HIDDEN' -H "Accept: application/xml" https://HIDDEN/JSSResource/computers/id/$jamfID | xsltproc /tmp/computer.xslt -) echo "$fetchDetails"

Man I feel so stupid.

It worked, thank you so much ! Kinda mad I didn't ask for this earlier, I lost a few hours on this...

Though now I'll remember each header needs its " -H ".


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings