08-23-2021 10:20 AM - edited 08-23-2021 10:43 AM
Here is the line to get the data i want
staticGROUPusers=$( curl --user "${apiUSER}:${apiPASS}" --silent --show-error --header "Accept: text/xml" "${url}" )
I then write out a XSLT stylesheet for my needs
cat << EOF > "$folderLOCATION"/stylesheet.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_group/computers/computer">
<xsl:value-of select="serial_number"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
EOF
followed up with writing each serial to the file
serialNUMBERS=(`echo "$staticGROUPusers" | xsltproc "$folderLOCATION"/stylesheet.xslt -`)
Funny thing is, this has worked up to today, which, when i run it now, gives me no entries in the XSLT file (see below)
<?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_group/computers/computer">
<xsl:value-of select="serial_number"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
When i run the full script, I immediately get an error
-: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>
^
-:1: parser error : Document is empty
^
if i run the command
`echo "$staticGROUPusers" | xsltproc "$folderLOCATION"/stylesheet.xslt -`
i get this error
C02DR8CLMD6R:~ jche$ `echo "$staticGROUPusers" | xsltproc "$folderLOCATION"/stylesheet.xslt -`
-sh: C02VM05YHTD6: command not found
if i try without single quotes
echo "$staticGROUPusers" | xsltproc "$folderLOCATION"/stylesheet.xslt -
it gives me the output in term but no data is written to the file itself
C02DR8CLMD6R:~ jche$ echo "$staticGROUPusers" | xsltproc "$folderLOCATION"/stylesheet.xslt -
C02VM05YHTD6 C02YN39BJG5H C02CG0PDMD6V C02YN3G8JG5H C02ZJ88ZLVDL C02W42CWHTD6 C02DD6PBMD6R C02ZH03ZLVCF C02DR8CLMD6R
My account has r/w to the file also esp since im running locally.
Any ideas as to why or what the alternative could be?
EDIT: nvm, it wasnt that issue, i forgot to pass off env vars to script, apologies!