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 6722707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:28:45+00:00 2026-05-26T09:28:45+00:00

<xsl:apply-templates mode=block2sequence select=NewDataSet/Table[CTD_CTD_PKG_ID =$PackageId][position()=1] and NewDataSet/Table[CTD_SEQ_NUM =$strXSLMsgType][position()=1]/> why cant i use two conditions in

  • 0
<xsl:apply-templates mode="block2sequence" select="NewDataSet/Table[CTD_CTD_PKG_ID =$PackageId][position()=1] and NewDataSet/Table[CTD_SEQ_NUM =$strXSLMsgType][position()=1]"/>

why cant i use two conditions in above select condition, can any one suggest me

  • 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-05-26T09:28:46+00:00Added an answer on May 26, 2026 at 9:28 am
    <xsl:apply-templates mode="block2" 
         select="NewDataSet/Table[CTD_CTD_PKG_ID =$PackageId][position()=1] "/>
    

    why cant i use two conditions in above select condition

    I guess this is to mean, “why can’t the two conditions be specified in the same predicate?“

    The answer is that the expression:

    NewDataSet/Table[CTD_CTD_PKG_ID =$PackageId and position() = 1]
    

    isn’t equivalent at all to the 1st expression above.

    The first expression selects the first Table child of NewDataSet such that the string value of its CTD_CTD_PKG_ID child is equal to the string value of $PackageId. In this case we don’t know which child (at which position) of NewDataSet will be selected — any child that happens to be the first with the specified properties, will be selected.

    On the other side, the latter expression selects the first Table child of NewDataSet only if the string value of its CTD_CTD_PKG_ID child is equal to the string value of $PackageId. In this case, if anything is selected, it would be the first Table child.

    If you want an equivalent expression to the first one, that has only one predicate, one such expression is:

    NewDataSet/Table
          [CTD_CTD_PKG_ID =$PackageId 
         and 
           not(preceding-sibling::Table[CTD_CTD_PKG_ID =$PackageId ])
          ]
    

    Update: The OP has published a code snippet:

     <xsl:apply-templates mode="block2sequence" select=
        "NewDataSet/Table[CTD_CTD_PKG_ID =$PackageId][position()=1]
        and
         NewDataSet/Table[CTD_SEQ_NUM =$strXSLMsgType][position()=1]"/>
    

    This code will cause an error thrown at compile time by the XSLT processor.

    The value of the select attribute is a boolean (expr1 and expr2), however templates in XSLT 1.0 and XSLT 2.0 can only be applied on nodes. A boolean isn’t a node — hence the error.

    Solution:

    My first guess is that you want templates to be applied on both nodes. If this is so, then use:

     <xsl:apply-templates mode="block2sequence" select=
        "NewDataSet/Table[CTD_CTD_PKG_ID =$PackageId][1]
        |
         NewDataSet/Table[CTD_SEQ_NUM =$strXSLMsgType][1]"/>
    

    My second guess is that you want templates applied only on the first of the two nodes. If this is so, then use:

     <xsl:apply-templates mode="block2sequence" select=
        "(NewDataSet/Table[CTD_CTD_PKG_ID =$PackageId]
        |
         NewDataSet/Table[CTD_SEQ_NUM =$strXSLMsgType]
         )
          [1]
    "/>
    

    Notes:

    1. Please, learn how to ask a question — provide all relevant data and explain — in the question, not in subsequent comments.

    2. Did you know that [1] is equivalent to [position()=1] and is shorter?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below I'm trying to match certain nodes. <xsl:template match=nodes> <element> <xsl:apply-templates select=nodes mode=different />
<xsl:apply-templates select=element[child='Yes']> Works fine but I would like to use <xsl:apply-templates select=element[$childElementName='Yes']> so I
I'm calling a template: <table> <xsl:apply-templates select=data/pics/row/> </table> The template is <xsl:template match=row> <tr>
I'm starting to use XSLT, and I don't understand this line: <xsl:apply-templates select=file:file/file:description />
In a feedburner RSS I use <xsl:template match=node() | @*> <xsl:copy> <xsl:apply-templates select=node() |
I'm trying to order items based on an attribute value: <xsl:apply-templates select=Question> <xsl:sort order=ascending
I have the following template <h2>one</h2> <xsl:apply-templates select=one/> <h2>two</h2> <xsl:apply-templates select=two/> <h2>three</h2> <xsl:apply-templates select=three/>
<xsl:template match=o:CustomDocumentProperties> <xsl:copy> <xsl:apply-templates select =@*|node() /> </xsl:copy> </xsl:template> In word 2003, I am
I have a template: <xsl:template match=paragraph> ... </xsl:template> I call it: <xsl:apply-templates select=paragraph/> For
When I use apply-templates and select a variable sequence, does the template act upon

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.