Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7967917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:59:44+00:00 2026-06-04T06:59:44+00:00

Why doesn’t my XSL find anything to process in this XML? I am trying

  • 0

Why doesn’t my XSL find anything to process in this XML? I am trying to convert cognos xml report output into another form (yes I know cognos produces html, but I need something else). It just produces the word “Caption:” and stops.

Here is my XSL:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://developer.cognos.com/schemas/xmldata/1/" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">

    <xsl:template match="/">

    <xsl:template match="rows">
        <xsl:apply-templates select="rowEdge"/>
    </xsl:template>

    <xsl:template match="rowEdge">
        <b>Caption:</b> <xsl:value-of select="caption"/><br/>
        <xsl:if test="@id">
            <b>id:</b> <xsl:value-of select="@id"/><br/>
        </xsl:if>
        <xsl:if test="rowEdge">
            <xsl:apply-templates select="rowEdge"/>
        </xsl:if>
    </xsl:template>

    <html>
        <head><title>%s</title></head>
        <body>
            <xsl:apply-templates select="dataset/crosstab/rows"/>
        </body>
    </html>

    </xsl:template>
</xsl:stylesheet> 

Here is the XML (I had to delete some, but should give an idea):

<?xml version="1.0" encoding="utf-8" ?> 
 <dataset xmlns="http://developer.cognos.com/schemas/xmldata/1/" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
 <crosstab>
 <values>
  <value row="R1" col="C1" xs:nil="true" /> 
  <value row="R1" col="C2" xs:nil="true" /> 
  <value row="R1" col="C3" xs:nil="true" /> 
  <value row="R1" col="C4" xs:nil="true" /> 
  <value row="R1" col="C5" xs:nil="true" /> 
  <value row="R1" col="C6" xs:nil="true" /> 
  <value row="R1" col="C7" xs:nil="true" /> 
  <value row="R1" col="C8" xs:nil="true" /> 
  <value row="R1" col="C9" xs:nil="true" /> 
  <value row="R2" col="C1">0</value> 
  <value row="R2" col="C2">12.61728395</value> 
  <value row="R2" col="C3">1320.40677966</value> 
  <value row="R2" col="C4">7</value> 
  <value row="R2" col="C5">1.90318499</value> 
  <value row="R2" col="C6">108.66456135</value> 
  <value row="R2" col="C7">776.61407946</value> 
  <value row="R2" col="C8">-0.86007907</value> 
  <value row="R2" col="C9">46.53571429</value> 
</values>
 <corner>
  <caption>Time Period: DCG Incurred Paid Year</caption> 
  </corner>
 <columns>
 <colEdge>
  <caption>Jan 02 to Dec 02 {All Data} CRxIp</caption> 
 <colEdge>
  <caption>2002</caption> 
 <colEdge id="C1">
  <caption>Member Age Avg</caption> 
  </colEdge>
 <colEdge id="C2">
  <caption>Days Supply Per Script Rx</caption> 
  </colEdge>
 <colEdge id="C3">
  <caption>Net Pay Per Pat Med</caption> 
  </colEdge>
 <colEdge id="C4">
  <caption>Days LOS Admit Acute</caption> 
  </colEdge>
 <colEdge id="C5">
  <caption>Days LOS Admit Acute</caption> 
  </colEdge>
 <colEdge id="C6">
  <caption>Allow Amt PMPM Med and Rx {Cmpl}</caption> 
  </colEdge>
 <colEdge id="C7">
  <caption>Allow Amt PMPM Med and Rx {Cmpl}</caption> 
  </colEdge>
 <colEdge id="C8">
  <caption>% Diff Allow Amt PMPM Med and Rx {Cmpl}</caption> 
  </colEdge>
 <colEdge id="C9">
  <caption>Relative Risk Score Prosp Explan NonRescaled</caption> 
  </colEdge>
  </colEdge>
  </colEdge>
  </columns>
 <rows>
 <rowEdge>
  <caption>Subsets</caption> 
 <rowEdge>
  <caption>Plan Type Medstat</caption> 
 <rowEdge id="R1">
  <caption>Cohort Medstat</caption> 
  </rowEdge>
  </rowEdge>
  </rowEdge>
 <rowEdge>
  <caption>Chronic Episodes</caption> 
 <rowEdge>
  <caption>HMO (Managed Care)</caption> 
 <rowEdge id="R2">
  <caption>Females, Ages &lt; 1</caption> 
  </rowEdge>
</rowEdge>
 </rowEdge>
 </rows>
  </crosstab>
  </dataset>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T06:59:44+00:00Added an answer on June 4, 2026 at 6:59 am

    In XSLT 1.0 (which you are using), default namespaces are not taken into account in XPath expressions.

    Whet you need to do is:

    1) Assign a prefix to the default namespace of your instance document in your XSLT transformation, for instance:

     <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="cog:http://developer.cognos.com/schemas/xmldata/1/" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
    

    2) Use this prefix before each element name (but not before attribute names) in your XPath expressions:

    <xsl:template match="cog:rowEdge">
        <b>Caption:</b> <xsl:value-of select="cog:caption"/><br/>
        <xsl:if test="@id">
           <b>id:</b> <xsl:value-of select="@id"/><br/>
        </xsl:if>
        <xsl:if test="cog:rowEdge">
            <xsl:apply-templates select="cog:rowEdge"/>
        </xsl:if>
    </xsl:template>
    

    Note: you don’t need to test that there is a cog:rowEdge before applying the templates: the apply-templates won’t do anything if there are no nodes in its select attribute anyway 😉 …

    There are a couple of other errors in the stylesheet:

    1. Templates can’t be embedded
    2. There must be a version attribute in the xsl:stylesheet element.

    The correct stylesheet would be:

    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cog="http://developer.cognos.com/schemas/xmldata/1/" version="1.0">
    
        <xsl:template match="/">
    
            <html>
                <head>
                    <title>%s</title>
                </head>
                <body>
                    <xsl:apply-templates select="cog:dataset/cog:crosstab/cog:rows"/>
                </body>
            </html>
    
        </xsl:template>
    
        <xsl:template match="cog:rows">
            <xsl:apply-templates select="cog:rowEdge"/>
        </xsl:template>
    
        <xsl:template match="cog:rowEdge">
            <b>Caption:</b>
            <xsl:value-of select="cog:caption"/>
            <br/>
            <xsl:if test="@id">
                <b>id:</b>
                <xsl:value-of select="@id"/>
                <br/>
            </xsl:if>
            <xsl:apply-templates select="cog:rowEdge"/>
        </xsl:template>
    
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Doesn't seem to be anything about this online, I need to run fetch query
This doesn't have to be Java, but it's what I'm dealing with. Also, not
Doesn't matter what I do, I simply can't get this to play a sound
Why doesn't this work: <Style TargetType=s:Substance> <Setter Property=Template> <Setter.Value> <DataTemplate> <StackPanel> <TextBlock Text={TemplateBinding Name}/>
This doesn't work: $to = 'myemail@gmail.com'; $from = 'test@test.com'; $subj = 'test'; $message =
Why doesn't this code work? I'am using FF. <head> <script type=text/javascript> document.getElementById(someID).onclick = function(){
There doesn't seem to be a question for this, and it seems strange that
this is what i have right now Drawing an RSS feed into the php,
This doesn't make sense to me yet. So the first while loop runs and
Why doesn't this work? type RetryBuilder(max) = member x.Return(a) = a // Enable 'return'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.