3 Replies Latest reply on Apr 9, 2010 2:22 PM by reppert

    xsl issue in indesign with group commands

    reppert

      Currently I have a customer that is giving me most of my database file in excel. Excel seems to not be able to hand't sub nodes so I am required to make up a simple xml file like this:

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

      <Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

      <Story>

      <SectionCode>01</SectionCode>

      <SectionName>FRAME</SectionName>

      <Code>PD</Code>

      <ItemNum>IN054B</ItemNum>

      <Vendor>ALI ARC (AN)</Vendor>

      <Description>AliArc 92/9400 Bumper '97 &amp; Up</Description>

      <Price>2350</Price>

      <Photo>1</Photo>

      </Story>

      <Story>

      <SectionName>FRAME</SectionName>

      <Code>PD</Code>

      <ItemNum>IN064F</ItemNum>

      <Vendor>ALI ARC (AN)</Vendor>

      <Description>AliArc 9900 Bumper</Description>

      <Price>2261.95</Price>

      <Photo>2</Photo>

      </Story>

      <Story>

      <SectionName>FRAME</SectionName>

      <Code>PD</Code>

      <ItemNum>IN064T</ItemNum>

      <Vendor>ALI ARC (AN)</Vendor>

      <Description>AliArc 9900 Bumper Texas</Description>

      <Price>2800.51</Price>

      <Photo>3</Photo>

      </Story>

      </Root>

       

      Problem arises with the xsl brought into indesign.

      It only gives me the first story and nothing else but if I use oxygen and debug with xsl and save I get what I need perfectly.

      I want to not have to use oxygen and just use indesign to give me the final product.

      Here is the xsl:

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

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

          xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs"

          xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" version="2.0">

          <xsl:output method="xml" omit-xml-declaration="no" indent="yes" encoding="US-ASCII"/>

          <xsl:decimal-format name="money" digit="D"/>

          <xsl:template match="Root">

              <Root>

                  <Story>

                      <xsl:for-each-group select="Story" group-by="SectionName">

                          <TableSection>

                              <xsl:for-each select="current-group()">

                                  <xsl:if test="SectionCode>0">

                                      <SectionCode>

                                          <xsl:value-of select="SectionCode"/>

                                      </SectionCode>

                                      <SectionName>

                                          <xsl:value-of select="SectionName"/>

                                      </SectionName>

                                  </xsl:if>

                                  <Code>

                                      <xsl:value-of select="Code"/>

                                  </Code>

                                  <ItemNum>

                                      <xsl:value-of select="ItemNum"/>

                                  </ItemNum>

                                  <Vendor>

                                      <xsl:value-of select="Vendor"/>

                                  </Vendor>

                                  <Description>

                                      <xsl:value-of select="Description"/>

                                  </Description>

                                  <Price>

                                      <xsl:value-of select="format-number(Price,'$D,DDD,DD0.00','money')"/>

                                  </Price>

                                  <Photo>Picture </Photo>

                              </xsl:for-each>

                          </TableSection>

                      </xsl:for-each-group>

                  </Story>

              </Root>

          </xsl:template>

      </xsl:stylesheet>

      Using oxygen final xml that works in indesign:<?xml version="1.0" encoding="US-ASCII"?>
         <Story>
            <TableSection>
               <SectionCode>01</SectionCode>
               <SectionName>FRAME</SectionName>
               <Code>PD</Code>
               <ItemNum>IN054B</ItemNum>
               <Vendor>ALI ARC (AN)</Vendor>
               <Description>AliArc 92/9400 Bumper '97 &amp; Up</Description>
               <Price>$2,350.00</Price>
               <Photo>Picture </Photo>
               <Code>PD</Code>
               <ItemNum>IN064F</ItemNum>
               <Vendor>ALI ARC (AN)</Vendor>
               <Description>AliArc 9900 Bumper</Description>
               <Price>$2,261.95</Price>
               <Photo>Picture </Photo>
               <Code>PD</Code>
               <ItemNum>IN064T</ItemNum>
               <Vendor>ALI ARC (AN)</Vendor>
               <Description>AliArc 9900 Bumper Texas</Description>
               <Price>$2,800.51</Price>
               <Photo>Picture </Photo>
            </TableSection>
      </story>
      This is cut from a very large file so I added the last closing tags on the xml files. The major problem I think is the engine and dealing with the for-each-group or the for-each select="current-group()". Both give me problem in other engines like xalan. Any help or ideas to fix would be appreciated. As for the excel file if anyone know a way to make it work the subnodes so I can easily group the items in excel and not have to do the xsl that would be good too.
      Thanks

        • 1. Re: xsl issue in indesign with group commands
          Ian Proudfoot Level 3

          Reppert,

           

          This could be because your XSLT is version 2.0 while InDesign's Sablotron processor only supports XSLT version 1.0. Could you write your transform using the lesser abilities of XSLT1.0?

           

          Regards

          Ian

          • 2. Re: xsl issue in indesign with group commands
            reppert Level 1

            Thanks for the reply.

            I can try to do it in a xsl v.1 but not quite sure how that would be done. Thing is I am trying to take a spreadsheet and convert it to xml which is each item(row) as a seperate item in the xml. I need to convert that xml so that I can drop it into indesign and into a table. It works if I let oxygen convert it with the xsl but in indesign I import it into a current table but the problem is it starts repeating the first item in the xml over and over again if the previous table has more rows than the current table.

             

            I some how need to convert the xml file from excel into an acceptable indesign xml table format. Thats the tricky part with the way excel handles the information. No Lists inside of lists allowed.

            • 3. Re: xsl issue in indesign with group commands
              reppert Level 1

              Will start a new post. After being told it was version 1 tried a new route.