xslt: trouble with nested for each statement and concatenation

I'm having trouble with some nested for each statements and concatenation. See my input and xslt below. Everything's fine except the nested foreach and concat portions. How do I fix this? I need to concatenate PrestoURL# and PrestoURLNote#s to form complete links. See the xslt snippet and xml input below. I've attached the complete xslt as well.
xslt:
<xsl:for-each select="inm:PrestoURL1[string(.)] | inmr0:PrestoURL1[string(.)]">
<PropertyValue name="Link1">
<xsl:value-of select="concat( '&lt;A href=&quot;http://prestohost08.inmagic.com', .,'&quot; target=&quot;_blank&quot;&gt;')"/>
<xsl:for-each select="/inm:Results/inm:Recordset/inm:Record/inm:PrestoURLNote1[string(.)] | inmr0:PrestoURLNote1[string(.)]">
<xsl:value-of select="concat(.,'&lt;/A&gt;')"/>
</xsl:for-each>
</PropertyValue>
</xsl:for-each>
<xsl:for-each select="inm:PrestoURL2[string(.)] | inmr0:PrestoURL2[string(.)]">
<PropertyValue name="Link2">
<xsl:value-of select="concat( '&lt;A href=&quot;http://prestohost08.inmagic.com', .,'&quot; target=&quot;_blank&quot;&gt;')"/>
<xsl:for-each select="/inm:Results/inm:Recordset/inm:Record/inm:PrestoURLNote2[string(.)] | inmr0:PrestoURLNote2[string(.)]">
<xsl:value-of select="concat(.,'&lt;/A&gt;')"/>
</xsl:for-each>
</PropertyValue>
</xsl:for-each>
<xsl:for-each select="inm:PrestoURL3[string(.)] | inmr0:PrestoURL3[string(.)]">
<PropertyValue name="Link3">
<xsl:value-of select="concat( '&lt;A href=&quot;http://prestohost08.inmagic.com', .,'&quot; target=&quot;_blank&quot;&gt;')"/>
<xsl:for-each select="/inm:Results/inm:Recordset/inm:Record/inm:PrestoURLNote3[string(.)] | inmr0:PrestoURLNote3[string(.)]">
<xsl:value-of select="concat(.,'&lt;/A&gt;')"/>
</xsl:for-each>
</PropertyValue>
</xsl:for-each>
 
+++++++++++++++++++++++++++++
 
input: 
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<inm:Results productTitle="Inmagic CS/TextWorks" productVersion="11.00" xmlns:inm="http://www.inmagic.com/webpublisher/query">
<inm:Recordset setCount="1170">
<inm:Record setEntry="1">
<inm:CatID>603</inm:CatID>
<inm:CatCallNumber />
<inm:CatTitle>ACUHO-I 2000-2001 Salary Survey</inm:CatTitle>
<inm:CatSubtitle />
<inm:CatAlternateTitle />
<inm:CatAuthor>ACUHO-I</inm:CatAuthor>
<inm:CatCorporateAuthor />
<inm:CatResponsibility />
<inm:CatEditor />
<inm:CatEdition />
<inm:CatSource />
<inm:CatPlace>Columbus, OH</inm:CatPlace>
<inm:CatPublisher>ACUHO-I</inm:CatPublisher>
<inm:CatDatePublished>2001</inm:CatDatePublished>
<inm:CatPhysDesc />
<inm:CatSeries />
<inm:CatSubjects>Staff recruitment and retention</inm:CatSubjects>
<inm:CatSubjects>Staff benefits</inm:CatSubjects>
<inm:CatAbstract />
<inm:CatNotes>paper copy held in library</inm:CatNotes>
<inm:CatISBN />
<inm:CatISSN />
<inm:CatLanguage />
<inm:CatRecordType />
<inm:CatStatus />
<inm:CatLocation />
<inm:CatLCCard />
<inm:CatSerFrequency />
<inm:CatSerIssuesPerVol />
<inm:CatSerHoldings>2001</inm:CatSerHoldings>
<inm:CatSerSpecialIssues />
<inm:CatSerIndexedIn />
<inm:CatSerRetention />
<inm:CatURL />
<inm:CatUrlNotes />
<inm:CatImage />
<inm:CatFileName />
<inm:CatFullText />
<inm:CatDateCataloged />
<inm:CatDateApproved />
<inm:CatDateCreated>08/01/06</inm:CatDateCreated>
<inm:CatDateModified>08/01/06</inm:CatDateModified>
<inm:CatMyAnalytics />
<inm:CatMyCompany />
<inm:CatMyGMD />
<inm:CatMyCopyrighted />
<inm:CatCategory>Staff Salary &amp; Job Descriptions</inm:CatCategory>
<inm:CatCreatedBy>cbarnett</inm:CatCreatedBy>
<inm:CatHowCreated>cbarnett</inm:CatHowCreated>
<inm:PrestoMainFile />
<inm:PrestoAddnlFile />
<inm:Count />
<inm:Batch />
<inm:PrestoURL1>\inmagicgenie\ToCImageFolder\2006\08\01salarysurveyp.58-71.pdf</inm:PrestoURL1>
<inm:PrestoURL2>\inmagicgenie\ToCImageFolder\2006\08\01salarysurveyp.72-81.pdf</inm:PrestoURL2>
<inm:PrestoURL3>\inmagicgenie\ToCImageFolder\2006\08\01salarysurveyp.82-98.pdf</inm:PrestoURL3>
<inm:PrestoURL4>\inmagicgenie\ToCImageFolder\2006\08\01Salarysurveyp.99-115.pdf</inm:PrestoURL4>
<inm:PrestoURL5>\inmagicgenie\ToCImageFolder\106\08\/Volumes/ANDREA/01salarysurveyp116-126.pdf</inm:PrestoURL5>
<inm:PrestoURL6>\inmagicgenie\ToCImageFolder\106\08\/Volumes/ANDREA/01salarysurvey127-141.pdf</inm:PrestoURL6>
<inm:PrestoURL7>\inmagicgenie\ToCImageFolder\106\08\/Volumes/ANDREA/01salarysurvey142-150.pdf</inm:PrestoURL7>
<inm:PrestoURL8 />
<inm:PrestoURL9>\inmagicgenie\ToCImageFolder\2006\08\01salarysurveyp1-15.pdf</inm:PrestoURL9>
<inm:PrestoURL10>\inmagicgenie\ToCImageFolder\106\08\/Volumes/ANDREA/01salarysurveyp.16-30.pdf</inm:PrestoURL10>
<inm:PrestoURL11>\inmagicgenie\ToCImageFolder\106\08\/Volumes/ANDREA/01salarysurveyp31-43.pdf</inm:PrestoURL11>
<inm:PrestoURL12>\inmagicgenie\ToCImageFolder\106\08\/Volumes/ANDREA/01salarysurveyp.44-57.pdf</inm:PrestoURL12>
<inm:PrestoURL13 />
<inm:PrestoURL14 />
<inm:PrestoURL15 />
<inm:PrestoURL16 />
<inm:PrestoURL17 />
<inm:PrestoURL18 />
<inm:PrestoURL19 />
<inm:PrestoURL20 />
<inm:PrestoURLNote1>Salary Survey pages 58-71</inm:PrestoURLNote1>
<inm:PrestoURLNote2>Salary Survey pages 72-81</inm:PrestoURLNote2>
<inm:PrestoURLNote3>Salary Survey pages 82-98</inm:PrestoURLNote3>
<inm:PrestoURLNote4>Salary Survey pages 99-115</inm:PrestoURLNote4>
<inm:PrestoURLNote5>Salary Survey pages 116-126</inm:PrestoURLNote5>
<inm:PrestoURLNote6>Salary Survey pages 127-141</inm:PrestoURLNote6>
<inm:PrestoURLNote7>Salary Survey pages 142-150</inm:PrestoURLNote7>
<inm:PrestoURLNote8 />
<inm:PrestoURLNote9>Salary Survey pages 1-15</inm:PrestoURLNote9>
<inm:PrestoURLNote10>Salary Survey pages 16-30</inm:PrestoURLNote10>
<inm:PrestoURLNote11>Salary Survey pages 31-43</inm:PrestoURLNote11>
<inm:PrestoURLNote12>Salary Survey pages 44-57</inm:PrestoURLNote12>
<inm:PrestoURLNote13 />
<inm:PrestoURLNote14 />
<inm:PrestoURLNote15 />
<inm:PrestoURLNote16 />
<inm:PrestoURLNote17 />
<inm:PrestoURLNote18 />
<inm:PrestoURLNote19 />
<inm:PrestoURLNote20 />
</inm:Record>
<inm:Record setEntry="2">
<inm:CatID>1332</inm:CatID>
<inm:CatCallNumber />
<inm:CatTitle>The Praxis of Poverty:</inm:CatTitle>
<inm:CatSubtitle />
<inm:CatAlternateTitle />
<inm:CatAuthor>Orio, Julie</inm:CatAuthor>
<inm:CatAuthor>Ranck, Lorrie</inm:CatAuthor>
<inm:CatCorporateAuthor />
<inm:CatResponsibility />
<inm:CatEditor />
<inm:CatEdition />
<inm:CatSource />
<inm:CatPlace>Dallas, Texas</inm:CatPlace>
<inm:CatPublisher />
<inm:CatDatePublished>2008</inm:CatDatePublished>
<inm:CatPhysDesc>PowerPoint, 13 slides.</inm:CatPhysDesc>
<inm:CatSeries>2008 Living-Learning Conference</inm:CatSeries>
<inm:CatSubjects>Service Learning</inm:CatSubjects>
<inm:CatSubjects>Living learning programs</inm:CatSubjects>
<inm:CatAbstract />
<inm:CatNotes>This presentation explains the context in which the LLC is situated; the theme (poverty) of the LLC and the ways in which the community approached the theme.</inm:CatNotes>
<inm:CatISBN />
<inm:CatISSN />
<inm:CatLanguage />
<inm:CatRecordType>PowerPoint</inm:CatRecordType>
<inm:CatStatus />
<inm:CatLocation />
<inm:CatLCCard />
<inm:CatSerFrequency />
<inm:CatSerIssuesPerVol />
<inm:CatSerHoldings>October 26, 2008</inm:CatSerHoldings>
<inm:CatSerSpecialIssues />
<inm:CatSerIndexedIn />
<inm:CatSerRetention />
<inm:CatURL />
<inm:CatUrlNotes />
<inm:CatImage />
<inm:CatFileName />
<inm:CatFullText />
<inm:CatDateCataloged />
<inm:CatDateApproved />
<inm:CatDateCreated>11/25/08</inm:CatDateCreated>
<inm:CatDateModified />
<inm:CatMyAnalytics />
<inm:CatMyCompany />
<inm:CatMyGMD />
<inm:CatMyCopyrighted />
<inm:CatCategory>Specialized Housing</inm:CatCategory>
<inm:CatCreatedBy />
<inm:CatHowCreated>somebody</inm:CatHowCreated>
<inm:PrestoMainFile />
<inm:PrestoAddnlFile />
<inm:Count />
<inm:Batch />
<inm:PrestoURL1>\inmagicgenie\ToCImageFolder\2008\11\4.5.ppt</inm:PrestoURL1>
<inm:PrestoURL2 />
<inm:PrestoURL3 />
<inm:PrestoURL4 />
<inm:PrestoURL5 />
<inm:PrestoURL6 />
<inm:PrestoURL7 />
<inm:PrestoURL8 />
<inm:PrestoURL9 />
<inm:PrestoURL10 />
<inm:PrestoURL11 />
<inm:PrestoURL12 />
<inm:PrestoURL13 />
<inm:PrestoURL14 />
<inm:PrestoURL15 />
<inm:PrestoURL16 />
<inm:PrestoURL17 />
<inm:PrestoURL18 />
<inm:PrestoURL19 />
<inm:PrestoURL20 />
<inm:PrestoURLNote1>PowerPoint</inm:PrestoURLNote1>
<inm:PrestoURLNote2 />
<inm:PrestoURLNote3 />
<inm:PrestoURLNote4 />
<inm:PrestoURLNote5 />
<inm:PrestoURLNote6 />
<inm:PrestoURLNote7 />
<inm:PrestoURLNote8 />
<inm:PrestoURLNote9 />
<inm:PrestoURLNote10 />
<inm:PrestoURLNote11 />
<inm:PrestoURLNote12 />
<inm:PrestoURLNote13 />
<inm:PrestoURLNote14 />
<inm:PrestoURLNote15 />
<inm:PrestoURLNote16 />
<inm:PrestoURLNote17 />
<inm:PrestoURLNote18 />
<inm:PrestoURLNote19 />
<inm:PrestoURLNote20 />
</inm:Record>
<inm:Record setEntry="3">
<inm:CatID>1333</inm:CatID>
<inm:CatCallNumber />
<inm:CatTitle>The &apos;Greenhouse&apos; Takes Root:</inm:CatTitle>
<inm:CatSubtitle />
<inm:CatAlternateTitle />
<inm:CatAuthor>Denton, Michael</inm:CatAuthor>
<inm:CatCorporateAuthor />
<inm:CatResponsibility />
<inm:CatEditor />
<inm:CatEdition />
<inm:CatSource />
<inm:CatPlace>Dallas, Texas</inm:CatPlace>
<inm:CatPublisher />
<inm:CatDatePublished>2008</inm:CatDatePublished>
<inm:CatPhysDesc>PDF, 36p.</inm:CatPhysDesc>
<inm:CatSeries>2008 Living-Learning Conference</inm:CatSeries>
<inm:CatSubjects>First-year students</inm:CatSubjects>
<inm:CatSubjects>academic success</inm:CatSubjects>
<inm:CatAbstract />
<inm:CatNotes>This presentation discusses how to design a program from assessment data; examines different approaches for assessing residential academic initiatives; and explains the challenges and successes of creating significant change in residential programs.</inm:CatNotes>
<inm:CatISBN />
<inm:CatISSN />
<inm:CatLanguage />
<inm:CatRecordType>PDF</inm:CatRecordType>
<inm:CatStatus />
<inm:CatLocation />
<inm:CatLCCard />
<inm:CatSerFrequency />
<inm:CatSerIssuesPerVol />
<inm:CatSerHoldings>October 27, 2008</inm:CatSerHoldings>
<inm:CatSerSpecialIssues />
<inm:CatSerIndexedIn />
<inm:CatSerRetention />
<inm:CatURL />
<inm:CatUrlNotes />
<inm:CatImage />
<inm:CatFileName />
<inm:CatFullText />
<inm:CatDateCataloged />
<inm:CatDateApproved />
<inm:CatDateCreated>11/25/08</inm:CatDateCreated>
<inm:CatDateModified>11/25/08</inm:CatDateModified>
<inm:CatMyAnalytics />
<inm:CatMyCompany />
<inm:CatMyGMD />
<inm:CatMyCopyrighted />
<inm:CatCategory>Specialized Housing</inm:CatCategory>
<inm:CatCreatedBy>someperson</inm:CatCreatedBy>
<inm:CatHowCreated>otherperson</inm:CatHowCreated>
<inm:PrestoMainFile />
<inm:PrestoAddnlFile />
<inm:Count />
<inm:Batch />
<inm:PrestoURL1>\inmagicgenie\ToCImageFolder\2008\11\Denton_Michael_5.5_Greenhouse_LLC_Final.pdf</inm:PrestoURL1>
<inm:PrestoURL2 />
<inm:PrestoURL3 />
<inm:PrestoURL4 />
<inm:PrestoURL5 />
<inm:PrestoURL6 />
<inm:PrestoURL7 />
<inm:PrestoURL8 />
<inm:PrestoURL9 />
<inm:PrestoURL10 />
<inm:PrestoURL11 />
<inm:PrestoURL12 />
<inm:PrestoURL13 />
<inm:PrestoURL14 />
<inm:PrestoURL15 />
<inm:PrestoURL16 />
<inm:PrestoURL17 />
<inm:PrestoURL18 />
<inm:PrestoURL19 />
<inm:PrestoURL20 />
<inm:PrestoURLNote1>PDF</inm:PrestoURLNote1>
<inm:PrestoURLNote2 />
<inm:PrestoURLNote3 />
<inm:PrestoURLNote4 />
<inm:PrestoURLNote5 />
<inm:PrestoURLNote6 />
<inm:PrestoURLNote7 />
<inm:PrestoURLNote8 />
<inm:PrestoURLNote9 />
<inm:PrestoURLNote10 />
<inm:PrestoURLNote11 />
<inm:PrestoURLNote12 />
<inm:PrestoURLNote13 />
<inm:PrestoURLNote14 />
<inm:PrestoURLNote15 />
<inm:PrestoURLNote16 />
<inm:PrestoURLNote17 />
<inm:PrestoURLNote18 />
<inm:PrestoURLNote19 />
<inm:PrestoURLNote20 />
</inm:Record>
</inm:Recordset>
</inm:Results>

Open in new window

xslt.txt
GessWurkerAsked:
Who is Participating?
 
zc2Commented:
I see at least one problem - more then one closing "/A" concatenation. Is that you mean?
It occurs because you do not specify from which record you are taking the PrestoURLNote#
To fix it you can add a variable wit current record number, like
<xsl:variable name="rec-num" select="position()"/>
and use it in the expressions:
<xsl:for-each select="/inm:Results/inm:Recordset/inm:Record[$rec-num]/inm:PrestoURLNote1[string(.)] | inmr0:PrestoURLNote1[string(.)]">

Honestly, I found your code kinda ponderous. It hard to advise not knowing what it suppose to do, but I guess, there is a lot what can be improved.
0
 
zc2Commented:
Is not the problem only because the XSLT  refers to missed namespace 'inmr0' ?
0
 
GessWurkerAuthor Commented:
It's not missing. Look at the attached xslt and you'll find:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:inm="http://www.inmagic.com/webpublisher/query"
xmlns:inmr0="http://www.inmagic.com/webpublisher/schemas/Textbase_recordset">
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
GessWurkerAuthor Commented:
Yes, I'm getting the extra closing /a. That may be the biggest problem. However, I'm not sure how to execute your suggestion.
0
 
zc2Commented:
Declare the xsl:variable I mentioned right after
<xsl:for-each select="inm:Record"> element (i.e. in the line 13)

In each XPath expression where you need to access only the elements of the _current_ inm:Record, use the variable value in the squared brackets.
Or, you can put to the variable the reference to the current inm:Record, like
<xsl:variable name="cur-record" select="."/>

, and them use it as follows:

<xsl:for-each select="$cur-record/inm:PrestoURLNote1[string(.)] | inmr0:PrestoURLNote1[string(.)]">

0
 
GessWurkerAuthor Commented:
Perfect. Thanks for your help!
0
 
GessWurkerAuthor Commented:
...even if you did call the code ponderous...

;)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.