PS Query & SQL

 View Only
  • 1.  Using XSLT in Query Manager Transformations tab

    Posted 10-02-2025 01:54 PM

    When I try to download my query results as XML, my tags don't have the heading text that I set up in my query, instead I get the field name or expression name when using an expression. Example:

    <SUBJECT><![CDATA[CHEM]]></SUBJECT>
    <EXPR11_11><![CDATA[101]]></EXPR11_11>

    My heading text for SUBJECT is "Subject" and my heading text for EXPR11_11 is "Number". Furthermore, each value being returned is preceded by "![CDATA[xxxx]]" and has brackets around it.

    To get around this, I tried using the transformations tab and scheduling the query to output as XFORM. I am using Copilot AI to help me create the XSLT to insert into the Transformations tab and output the file as XML. Whether I run the query as XML or schedule as XFORM, I am not having any luck converting my data into an XML file with the field names I want and the data being there.

    I am getting the below output when trying to run:

    This XML file does not appear to have any style information associated with it. The document tree is shown below.

    Below is the current XSLT I am using in the query:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     
      <xsl:output method="xml" indent="yes"/>
     
      <xsl:template match="/">
        <Courses>
          <xsl:for-each select="Query/ROWSET/ROW">
            <Course>
              <Subject><xsl:value-of select="Subject"/></Subject>
              <Number><xsl:value-of select="Number"/></Number>
              <Department><xsl:value-of select="Department"/></Department>
              <Title><xsl:value-of select="Title"/></Title>
              <TermType><xsl:value-of select="TermType"/></TermType>
              <Credits><xsl:value-of select="Credits"/></Credits>
              <Level><xsl:value-of select="Level"/></Level>
              <Prerequisites><xsl:value-of select="Prerequisites"/></Prerequisites>
              <LongTitle><xsl:value-of select="LongTitle"/></LongTitle>
              <Materials><xsl:value-of select="Materials"/></Materials>
            </Course>
          </xsl:for-each>
        </Courses>
      </xsl:template>
     
    </xsl:stylesheet>
    If anyone has any suggestions or documentation to help me get the desired result, I would appreciate it.
    Thanks!


    ------------------------------
    Leo Pappalas
    Senior Academic Systems Analyst
    City Colleges of Chicago-District Office
    ------------------------------

    Message from the HEUG Marketplace:
    ------------------------------
    Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the HEUG Marketplace.
    ------------------------------
    Alliance 2026 Registration is Open!


  • 2.  RE: Using XSLT in Query Manager Transformations tab

    Posted 10-02-2025 01:59 PM

    Name your fields in the Unique Field Name.

     

     

    Mine is a union so on the top level, I named this particular field PROGRAM and on the bottom (or side, whatever) level I named it PROGRAM2.


    This is what my XSLT looks like for just the program field.  The pink is the "header" for the file.  The blue is pulling in my values from both sides of the query.

     

    <?xml version="1.0" encoding="ISO-8859-1"?>

    <xsl:stylesheet version="1.0" xmlns:xsl=http://www.w3.org/1999/XSL/Transform>

    <xsl:variable name="separ">,</xsl:variable>

    <xsl:variable name="delim">"</xsl:variable>

    <xsl:output indent="no" omit-xml-declaration="yes" method="text" encoding="utf-8"/>

    <xsl:template match="/query">

    <xsl:text>PROGRAM</xsl:text>

    <xsl:value-of select="$separ"/>

    <xsl:text>&#xA;</xsl:text>

    <xsl:for-each select="/query/row">

    <xsl:value-of select="PROGRAM"/><xsl:value-of select="PROGRAM2"/>

    <xsl:value-of select="$separ"/>

    <xsl:text>&#xA;</xsl:text>

    </xsl:for-each>

    </xsl:template>

    </xsl:stylesheet>

     




    Alliance 2026 Registration is Open!


  • 3.  RE: Using XSLT in Query Manager Transformations tab

    Posted 10-02-2025 02:00 PM

    And for fields that I'm actually using a field and not an expression, it looks like this:

     

    <xsl:value-of select="C.CAMPUS_ID"/><xsl:value-of select="N.CAMPUS_ID"/>

     




    Alliance 2026 Registration is Open!


  • 4.  RE: Using XSLT in Query Manager Transformations tab

    Posted 10-06-2025 12:59 PM

    Go to the 'Fields' tab, click to edit on one of the fields, then rename whatever is in the "Unique Field Name" field. Tell it OK and then see if that field is fixed in your XML.

     

     

    Lynn Hutchins
    IT – Business Analyst
    Information Services
    lynn.hutchins@cwu.edu

     

     

     

     




    Alliance 2026 Registration is Open!