2012-11-25 2 views
0

2 개의 XML을 가져 와서 데이터를 결합하는 XSL에서 깨끗한 XML을 출력하는 방법을 알아 내는데 큰 문제가 발생했습니다.XSL에서 결합 된 XML의 출력 XML

나는 내 솔루션이라고 생각하는 <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>에 대한 자세한 정보를 찾으려고했지만 모든 것을 하나의 견고한 XML 파일로 가져 오는 방법을 얻지 못했습니다. 내가 서버 스크립트에서 호출 할 때 멋지게 보이지만 일부는 HTML 태그와 내가 원하지 않는 다른 것들을 가지고있다. 여전히 XSL이기 때문이다.

나는 모든 대답을 appriciate
<?xml version="1.0" encoding="UTF-8" ?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"> 

    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> 

    <xsl:param name="source-producenter" select="'Producers.xml'"/> 
    <xsl:param name="source-positioner" select="'positioner.xml'"/> 
    <xsl:variable name="producenter" select="document($source-producenter)"/> 
    <xsl:variable name="Workbook" select="document($source-positioner)"/> 

    <xsl:template match="/"> 
    <Producers> 
     <xsl:for-each select="$producenter//producer"> 
     <producer> 

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

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

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

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

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

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

      <pic> 
      <xsl:value-of select="img"/> 
      </pic> 
      <!--Store id from producent into storeId xsl variable --> 
      <xsl:variable name="storedId" select="id"/> 
      <!--Using filter to get correct Cells for latitude and longitude and checks if text() in number is equal to our storedId variable--> 
      <xsl:variable name="selected" 
      select="$Workbook//ss:Cell[@ss:Index='2']/ss:Data[@ss:Type='Number' and text() = $storedId]"/> 
      <!--Gets the filtered values--> 
      <latitude> 
      <xsl:value-of select="$selected//../../ss:Cell[2]/ss:Data"/> 
      </latitude> 
      <longitude> 
      <xsl:value-of select="$selected//../../ss:Cell[3]/ss:Data"/> 
      </longitude> 
     </producer> 
     </xsl:for-each> 
    </Producers> 
    </xsl:template> 
</xsl:stylesheet> 

가 사전에 감사합니다 :

이 내 코드입니다!

+0

질문을 편집하고 제공하십시오 : 1. 정확한 두 개의 XML 문서 (가능한 작게하십시오). 2. 변환이이 두 XML dcouments에 적용될 때 얻는 정확한 결과. 3. 당신이 얻고있는 결과에있어 잘못된 점. 4. 얻고 자하는 정확한 두 결과 XML. 서의 결과. –

답변

0

MSExcel에서 생성 된 XML을 변환하는 경우 (단서는 일부 요소의 ss : 접두사 임) Excel에서 @ss : Index 특성을 사용하는 방식을 알고 있어야합니다. 인접한 셀은이 속성을 생략하지만 빈 셀을 건너 뛰려면 후속 셀에 @ss : 색인이 있어야합니다. 부분적으로 채워진 세포 매트릭스의 기하학적 구조를 재구성하는 것은 상당히 고통 스럽습니다. 이것이 당신의 도전과 관련이 있다면 나는 꽤 이해할 수 없습니다.